Breadcrumbs help users understand where they are and jump back to parent pages. Items are driven by an options array; the active title is matched with activeBreadCrumb.
Setup
<script lang="ts">
import { Breadcrumb } from '.';
</script> Default
<script lang="ts">
import { Breadcrumb } from '.';
const options = [
{ title: 'Home', path: '/' },
{ title: 'Docs', path: '/docs' },
{ title: 'Breadcrumb', path: '/docs/components/breadcrumb' }
];
</script>
<Breadcrumb {options} activeBreadCrumb="Breadcrumb" /> Active color
activeClass colors the current crumb. Tokens: pink, blue, red, indigo, purple, black, amber, orange.
<script lang="ts">
import { Breadcrumb } from '.';
const options = [
{ title: 'Home', path: '/' },
{ title: 'Docs', path: '/docs' },
{ title: 'Breadcrumb', path: '/docs/components/breadcrumb' }
];
</script>
<Breadcrumb {options} activeBreadCrumb="Breadcrumb" activeClass="indigo" /> Deeper trail
<script lang="ts">
import { Breadcrumb } from '.';
const deep = [
{ title: 'Home', path: '/' },
{ title: 'Components', path: '/docs/components/button' },
{ title: 'Navigation', path: '/docs/components/breadcrumb' },
{ title: 'Breadcrumb', path: '/docs/components/breadcrumb' }
];
</script>
<Breadcrumb options={deep} activeBreadCrumb="Breadcrumb" /> Click handler
Use onclik (legacy spelling) to handle navigation yourself — each item passes { title, path, index }.
<script lang="ts">
import { Breadcrumb } from '.';
const options = [
{ title: 'Home', path: '/' },
{ title: 'Docs', path: '/docs' },
{ title: 'Breadcrumb', path: '/docs/components/breadcrumb' }
];
</script>
<Breadcrumb
{options}
activeBreadCrumb="Breadcrumb"
onclik={({ title, path, index }) => {
console.log(title, path, index);
}}
/> Props
| Prop | Type | Default | Description |
|---|---|---|---|
options | IBreadcrumb[] | [] | Crumb items (title, optional path, component, props) |
activeBreadCrumb | string | '' | Title that receives the active color |
activeClass | 'pink' | 'blue' | 'red' | 'indigo' | 'purple' | 'black' | 'amber' | 'orange' | 'blue' | Active text color token |
onclik | (val: IBreadcrumbClick) => void | — | Click handler (legacy spelling of “onclick”) |
IBreadcrumb
| Field | Type | Description |
|---|---|---|
title | string | Label shown in the trail |
path | string | Optional href / route for the click payload |
component | any | Optional custom renderer (advanced) |
props | any | Props for a custom component |
IBreadcrumbClick
| Field | Type | Description |
|---|---|---|
title | string | Clicked crumb title |
path | string | Optional path |
index | number | Index in options |