-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,269 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
--- | ||
title: Breadcrumb | ||
description: Displays the path to the current resource using a hierarchy of links. | ||
component: true | ||
source: https://github.com/huntabyte/shadcn-svelte/tree/main/apps/www/src/lib/registry/default/ui/breadcrumb | ||
--- | ||
|
||
<script> | ||
import { ComponentPreview, ManualInstall } from '$lib/components/docs'; | ||
</script> | ||
|
||
<ComponentPreview name="breadcrumb-demo"> | ||
|
||
<div /> | ||
|
||
</ComponentPreview> | ||
|
||
## Installation | ||
|
||
```bash | ||
npx shadcn-svelte@latest add breadcrumb | ||
``` | ||
|
||
<ManualInstall> | ||
|
||
1. Copy and paste the component source files linked at the top of this page into your project. | ||
|
||
</ManualInstall> | ||
|
||
## Usage | ||
|
||
```svelte | ||
<script lang="ts"> | ||
import * as Breadcrumb from "$lib/components/ui/breadcrumb/index.js"; | ||
</script> | ||
<Breadcrumb.Root> | ||
<Breadcrumb.List> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/">Home</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/components">Components</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Page>Breadcrumb</Breadcrumb.Page> | ||
</Breadcrumb.Item> | ||
</Breadcrumb.List> | ||
</Breadcrumb.Root> | ||
``` | ||
|
||
## Examples | ||
|
||
### Custom separator | ||
|
||
Use a custom component in the `<slot>` of `<Breadcrumb.Separator />` to create a custom separator. | ||
|
||
<ComponentPreview name="breadcrumb-separator"> | ||
|
||
<div /> | ||
|
||
</ComponentPreview> | ||
|
||
--- | ||
|
||
### Dropdown | ||
|
||
You can compose `<Breadcrumb.Item />` with a `<DropdownMenu />` to create a dropdown in the breadcrumb. | ||
|
||
<ComponentPreview name="breadcrumb-dropdown"> | ||
|
||
<div /> | ||
|
||
</ComponentPreview> | ||
|
||
--- | ||
|
||
### Collapsed | ||
|
||
We provide a `<Breadcrumb.Ellipsis />` component to show a collapsed state when the breadcrumb is too long. | ||
|
||
<ComponentPreview name="breadcrumb-ellipsis"> | ||
|
||
<div /> | ||
|
||
</ComponentPreview> | ||
|
||
--- | ||
|
||
### Link component | ||
|
||
To use a custom link component from your routing library, you can use the `asChild` prop on `<Breadcrumb.Link />`. | ||
|
||
<ComponentPreview name="breadcrumb-link"> | ||
|
||
<div /> | ||
|
||
</ComponentPreview> | ||
|
||
--- | ||
|
||
### Responsive | ||
|
||
Here's an example of a responsive breadcrumb that composes `<Breadcrumb.Item />` with `<Breadcrumb.Ellipsis />`, `<DropdownMenu />`, and `<Drawer />`. | ||
|
||
It displays a dropdown on desktop and a drawer on mobile. | ||
|
||
<ComponentPreview name="breadcrumb-responsive"> | ||
|
||
<div /> | ||
|
||
</ComponentPreview> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apps/www/src/lib/registry/default/example/breadcrumb-demo.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script lang="ts"> | ||
import * as Breadcrumb from "$lib/registry/default/ui/breadcrumb/index.js"; | ||
import * as DropdownMenu from "$lib/registry/default/ui/dropdown-menu/index.js"; | ||
</script> | ||
|
||
<Breadcrumb.Root> | ||
<Breadcrumb.List> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/">Home</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<DropdownMenu.Root> | ||
<DropdownMenu.Trigger class="flex items-center gap-1"> | ||
<Breadcrumb.Ellipsis class="h-4 w-4" /> | ||
<span class="sr-only">Toggle menu</span> | ||
</DropdownMenu.Trigger> | ||
<DropdownMenu.Content align="start"> | ||
<DropdownMenu.Item>Documentation</DropdownMenu.Item> | ||
<DropdownMenu.Item>Themes</DropdownMenu.Item> | ||
<DropdownMenu.Item>GitHub</DropdownMenu.Item> | ||
</DropdownMenu.Content> | ||
</DropdownMenu.Root> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/docs/components">Components</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Page>Breadcrumb</Breadcrumb.Page> | ||
</Breadcrumb.Item> | ||
</Breadcrumb.List> | ||
</Breadcrumb.Root> |
36 changes: 36 additions & 0 deletions
36
apps/www/src/lib/registry/default/example/breadcrumb-dropdown.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script lang="ts"> | ||
import * as Breadcrumb from "$lib/registry/default/ui/breadcrumb/index.js"; | ||
import * as DropdownMenu from "$lib/registry/default/ui/dropdown-menu/index.js"; | ||
import ChevronDown from "lucide-svelte/icons/chevron-down"; | ||
import Slash from "lucide-svelte/icons/slash"; | ||
</script> | ||
|
||
<Breadcrumb.Root> | ||
<Breadcrumb.List> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/">Home</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator> | ||
<Slash /> | ||
</Breadcrumb.Separator> | ||
<Breadcrumb.Item> | ||
<DropdownMenu.Root> | ||
<DropdownMenu.Trigger class="flex items-center gap-1"> | ||
Components | ||
<ChevronDown class="h-4 w-4" /> | ||
</DropdownMenu.Trigger> | ||
<DropdownMenu.Content align="start"> | ||
<DropdownMenu.Item>Documentation</DropdownMenu.Item> | ||
<DropdownMenu.Item>Themes</DropdownMenu.Item> | ||
<DropdownMenu.Item>GitHub</DropdownMenu.Item> | ||
</DropdownMenu.Content> | ||
</DropdownMenu.Root> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator> | ||
<Slash /> | ||
</Breadcrumb.Separator> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Page>Breadcrumb</Breadcrumb.Page> | ||
</Breadcrumb.Item> | ||
</Breadcrumb.List> | ||
</Breadcrumb.Root> |
23 changes: 23 additions & 0 deletions
23
apps/www/src/lib/registry/default/example/breadcrumb-ellipsis.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script lang="ts"> | ||
import * as Breadcrumb from "$lib/registry/default/ui/breadcrumb/index.js"; | ||
</script> | ||
|
||
<Breadcrumb.Root> | ||
<Breadcrumb.List> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/">Home</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Ellipsis /> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Link href="/docs/components">Components</Breadcrumb.Link> | ||
</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item> | ||
<Breadcrumb.Page>Breadcrumb</Breadcrumb.Page> | ||
</Breadcrumb.Item> | ||
</Breadcrumb.List> | ||
</Breadcrumb.Root> |
Oops, something went wrong.