Breadcrumb
NavigationThe trail from the app's top to the page the user is on, each step a link back. Given items ({ label, href }), <Breadcrumb.Root items={โฆ} /> draws it: links, chevrons between them, and the last item as the current page (aria-current="page"). Composed, a Breadcrumb.List holds Breadcrumb.Items (each a Breadcrumb.Link or the Breadcrumb.Current) with a Breadcrumb.Separator between them; Breadcrumb.Ellipsis stands for steps left out of a long trail. The root is a navigation landmark named label ("Breadcrumb").
import { Breadcrumb } from '@limerdev/zest'; Sidebar or NavigationMenu. Steps of a process (cart, shipping, payment): that is a stepper, not a trail. A one-level page: leave it out.Examples
A trail
Given items, the root draws the trail; the last item is the page the user is on.
<script lang="ts">
import { Breadcrumb } from '@limerdev/zest';
</script>
<Breadcrumb.Root
items={[
{ label: 'Customers', href: '#customers' },
{ label: 'Acme AB', href: '#acme' },
{ label: 'Invoice 1042' }
]}
/> A long trail
Composed by hand: the middle steps fold into an ellipsis that opens a menu of them.
<script lang="ts">
import { Breadcrumb, DropdownMenu } from '@limerdev/zest';
</script>
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#home">Home</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<DropdownMenu.Root>
<DropdownMenu.Trigger variant="ghost" size="icon-sm">
<Breadcrumb.Ellipsis />
</DropdownMenu.Trigger>
<DropdownMenu.Content align="start">
<DropdownMenu.Item>Customers</DropdownMenu.Item>
<DropdownMenu.Item>Acme AB</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Link href="#invoices">Invoices</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Current>Invoice 1042</Breadcrumb.Current>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root> Props
Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that
renders your own element, with props to spread on it).
Breadcrumb.Root
| Prop | Type | Default | Description |
|---|---|---|---|
| items | BreadcrumbEntry[] | [] | The trail, drawn when the root has no children: links, then the current page. |
| label | string | the Config's `strings.breadcrumb`, else 'Breadcrumb' | The navigation landmark's name, for screen readers. |
Breadcrumb.List
No props of its own beyond the common ones.
Breadcrumb.Item
No props of its own beyond the common ones.
Breadcrumb.Link
No props of its own beyond the common ones.
Breadcrumb.Current
No props of its own beyond the common ones.
Breadcrumb.Separator
No props of its own beyond the common ones.
Breadcrumb.Ellipsis
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | the Config's `strings.morePages`, else 'More pages' | What the ellipsis stands for, for screen readers. |