Breadcrumb
A breadcrumb that shows where the page sits in the application.
zb:breadcrumb zubazar/ui · free (MIT)
Basic usage
BLADE
Pass the items in the items array in order, from the root to the page; you don't need to add the root.
<zb:breadcrumb home-url="#" :items="[
['label' => 'Customers', 'url' => '#'],
['label' => 'Customer List', 'url' => '#'],
['label' => 'Edit'],
]" />
| Prop | Values |
|---|---|
items | [['label' => …, 'url' => …], …] |
With a route name
BLADE
Instead of a URL, pass a route name with the route key; the link is generated with route().
<zb:breadcrumb :items="[
['label' => 'Customers', 'route' => 'customers.index'],
['label' => $customer->name],
]" />
| Prop | Values |
|---|---|
items[].route | Route name |
items[].url | Direct URL; takes precedence over route |
Root link and item without a link
BLADE
Change the root link with home-route or home-url; an item in between without a URL (here "Reports") is rendered as plain text.
<zb:breadcrumb home-url="#" home-label="Dashboard home" :items="[
['label' => 'Reports'],
['label' => 'Sales report'],
]" />
| Prop | Values |
|---|---|
home-route | Route name of the root; default dashboard |
home-url | Direct URL of the root; takes precedence over home-route |
home-label | Accessible name of the root; default "Home" |
Composable usage
BLADE
Instead of items, write the items with zb:breadcrumb.item; an item with href is a link, and one without it (or with current) is the current page.
<div class="space-y-4">
<zb:breadcrumb home-url="#">
<zb:breadcrumb.item href="#">Stores</zb:breadcrumb.item>
<zb:breadcrumb.item href="#">Kadıköy branch</zb:breadcrumb.item>
<zb:breadcrumb.item>Orders</zb:breadcrumb.item>
</zb:breadcrumb>
<zb:breadcrumb home-url="#">
<zb:breadcrumb.item href="#" class="flex items-center gap-1"><zb:icon name="building-storefront" size="4" /> Stores</zb:breadcrumb.item>
<zb:breadcrumb.separator>/</zb:breadcrumb.separator>
<zb:breadcrumb.item :separator="false">Kadıköy branch <zb:badge variant="warning">3 orders waiting</zb:badge></zb:breadcrumb.item>
</zb:breadcrumb>
</div>
| Prop | Values |
|---|---|
zb:breadcrumb.item | href, current, separator |
zb:breadcrumb.separator | slot: separator (default: arrow) |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
items | — | [] | ['label' => …, 'url' => … | 'route' => …]; the last item and items without a URL are plain text |
home-route | — | dashboard | Route name of the root link; the site root if the route does not exist |
home-url | — | null | Direct URL of the root link |
home-label | — | null | Accessible name of the root; defaults to "Home" |
breadcrumb.item: href · current · separator | — | null · when no href · true | Link, current page (aria-current) and the separator before it |
breadcrumb.separator | — | — | Custom separator; an arrow when the slot is empty |
Developer notes
- A root link with a home icon is added at the start automatically; the last item, even with a link, is rendered as plain text as the current page and gets
aria-current="page". - The breadcrumb links open with
wire:navigate. - Written item by item, items can carry rich content such as icons and badges, and the home link is still added. If you change the separator with
zb:breadcrumb.separator, pass:separator="false"to the next item.