Navigation
Breadcrumb
Shows where a page sits in the customer area and links back up the path. Use it on detail pages two or more levels deep.
import * as Breadcrumb from '@statix/ui/breadcrumb';Examples
Basic
Links in muted text, the current page in ink. Chevrons separate the levels.
<script lang="ts">
import * as Breadcrumb from '@statix/ui/breadcrumb';
</script>
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#websites">Websites</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Link href="#yoga-berger">yoga-berger.de</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Page>Backups</Breadcrumb.Page>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>With an icon
A small icon can mark the start page. Keep the text label next to it.
<script lang="ts">
import * as Breadcrumb from '@statix/ui/breadcrumb';
import HouseIcon from '@lucide/svelte/icons/house';
</script>
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#start" class="inline-flex items-center gap-1.5">
<HouseIcon class="size-3.5" aria-hidden="true" />
Start
</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Link href="#email">E-Mail</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Page>info@yoga-berger.de</Breadcrumb.Page>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>Collapsed
Replace middle levels with Breadcrumb.Ellipsis when the path gets long.
<script lang="ts">
import * as Breadcrumb from '@statix/ui/breadcrumb';
</script>
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#websites">Websites</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Ellipsis />
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Link href="#backups">Backups</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Item>
<Breadcrumb.Page>Backup from 12 November, 03:10</Breadcrumb.Page>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>Custom separator
Pass children to Breadcrumb.Separator to use another mark, such as a slash.
<script lang="ts">
import * as Breadcrumb from '@statix/ui/breadcrumb';
</script>
<Breadcrumb.Root>
<Breadcrumb.List>
<Breadcrumb.Item>
<Breadcrumb.Link href="#domains">Domains</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator>/</Breadcrumb.Separator>
<Breadcrumb.Item>
<Breadcrumb.Link href="#yoga-berger">yoga-berger.de</Breadcrumb.Link>
</Breadcrumb.Item>
<Breadcrumb.Separator>/</Breadcrumb.Separator>
<Breadcrumb.Item>
<Breadcrumb.Page>DNS records</Breadcrumb.Page>
</Breadcrumb.Item>
</Breadcrumb.List>
</Breadcrumb.Root>Guidelines
Do
- Start at the product area ("Websites", "Domains"), not at "Start".
- Use the same names as the nav bar and page titles.
- End with the current page as Breadcrumb.Page, not as a link.
Don't
- Do not use a breadcrumb on top-level pages.
- Do not replace the back button or the main navigation with it.
Accessibility
- Renders a <nav aria-label="Breadcrumb"> with an ordered list, so screen readers announce the number of levels.
- Breadcrumb.Page sets aria-current="page".
- Separators and the ellipsis are aria-hidden. The ellipsis keeps a visually hidden "More" label.
API reference
Breadcrumb.Root
renders<nav> and accepts its attributes| Prop | Type | Default |
|---|---|---|
aria-label | string Names the landmark. | 'Breadcrumb' |
ref bind | HTMLElement | null The nav element. | – |
class | ClassValue Merged with the root classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb" | Always present. |
Breadcrumb.List
renders<ol> and accepts its attributesWraps the items. Sets the 13.5px small text and muted colour.
| Prop | Type | Default |
|---|---|---|
ref bind | HTMLOListElement | null The list. | – |
class | ClassValue Merged with the list classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb-list" | Always present. |
Breadcrumb.Item
renders<li> and accepts its attributes| Prop | Type | Default |
|---|---|---|
ref bind | HTMLLIElement | null The list item. | – |
class | ClassValue Merged with the item classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb-item" | Always present. |
Breadcrumb.Link
renders<a> and accepts its attributes| Prop | Type | Default |
|---|---|---|
href | string Link target. | – |
child | Snippet<[{ props }]> Render your own element, for example a router link, and spread props on it. | – |
ref bind | HTMLAnchorElement | null The link. | – |
class | ClassValue Merged with the link classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb-link" | Always present. |
Breadcrumb.Page
renders<span> and accepts its attributesThe current page. Medium weight, ink colour, aria-current="page".
| Prop | Type | Default |
|---|---|---|
ref bind | HTMLSpanElement | null The span. | – |
class | ClassValue Merged with the page classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb-page" | Always present. |
Breadcrumb.Separator
renders<li> and accepts its attributesA chevron by default. Children replace it.
| Prop | Type | Default |
|---|---|---|
ref bind | HTMLLIElement | null The list item. | – |
class | ClassValue Merged with the separator classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb-separator" | Always present. |
Breadcrumb.Ellipsis
renders<span> and accepts its attributesStands in for hidden levels.
| Prop | Type | Default |
|---|---|---|
ref bind | HTMLSpanElement | null The span. | – |
class | ClassValue Merged with the ellipsis classes. | – |
| Data attribute | Meaning |
|---|---|
data-slot="breadcrumb-ellipsis" | Always present. |