Breadcrumb
newThe path to the current page, as links separated by chevrons.
Installation
Usage
<script setup lang="ts">
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from '@/components/ui/breadcrumb'
</script>
<template>
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/docs/components">Components</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
</template>
Examples
Custom separator
Put your own icon in BreadcrumbSeparator's slot.
Dropdown
The demo above opens a menu from the ellipsis. The button around it carries the aria-label, since the ellipsis itself is hidden from screen readers.
Collapsed
BreadcrumbEllipsis stands in for the middle of a long trail.
Link component
BreadcrumbLink renders an a. Use as-child to render your router's link instead, such as NuxtLink or RouterLink.
API Reference
class is accepted on every part and merged over its classes with tailwind-merge.
BreadcrumbLink
| Prop | Default | Type and description |
|---|---|---|
| asChild | — | booleanRender the single child, such as your router's link, merging the link's attributes and classes onto it. |
| as | "a" | AsTag | ComponentThe element or component to render; an |
| Slot | Scope and description |
|---|---|
| default | {}The link text. |
Breadcrumb
| Slot | Scope and description |
|---|---|
| default | {}The |
BreadcrumbEllipsis
| Slot | Scope and description |
|---|---|
| default | {}The icon; a horizontal ellipsis by default. The text "More" stays for screen readers. |
BreadcrumbItem
| Slot | Scope and description |
|---|---|
| default | {}A link, the current page or an ellipsis. |
BreadcrumbList
| Slot | Scope and description |
|---|---|
| default | {}Items and separators, in order. |
BreadcrumbPage
| Slot | Scope and description |
|---|---|
| default | {}The current page's name. |
BreadcrumbSeparator
| Slot | Scope and description |
|---|---|
| default | {}The separator icon; a chevron by default. |
Props
- asChild
booleanRender the single child, such as your router's link, merging the link's attributes and classes onto it.- as
"a" AsTag | ComponentThe element or component to render; anaby default.
Slots
- default
{}The link text.
Slots
- default
{}TheBreadcrumbList.
Slots
- default
{}The icon; a horizontal ellipsis by default. The text "More" stays for screen readers.
Slots
- default
{}A link, the current page or an ellipsis.
Slots
- default
{}Items and separators, in order.
Slots
- default
{}The current page's name.
Slots
- default
{}The separator icon; a chevron by default.
Data attributes
| data-slot | Attributes | Description |
|---|---|---|
| breadcrumb | — | The nav, labelled "breadcrumb". |
| breadcrumb-list | — | The ordered list. |
| breadcrumb-item | — | One step of the trail. |
| breadcrumb-link | — | A link to an earlier page. |
| breadcrumb-page | — | The current page, with aria-current="page". |
| breadcrumb-separator | — | The icon between two items, hidden from screen readers. |
| breadcrumb-ellipsis | — | The icon in place of collapsed items. |