Breadcrumb
NavigationNavigation trail with 4 separator styles, icon support, 3 item styles, 3 sizes, and collapsible long paths.
Import
import Breadcrumb from '$lib/components/Breadcrumb.svelte';
import type { BreadcrumbItem } from '$lib/components/Breadcrumb.svelte';Usage
<script lang="ts">
import Breadcrumb from '$lib/components/Breadcrumb.svelte';
import type { BreadcrumbItem } from '$lib/components/Breadcrumb.svelte';
const items: BreadcrumbItem[] = [
{ label: 'Home', href: '/' },
{ label: 'Settings', href: '/settings' },
{ label: 'Profile' },
];
</script>
<Breadcrumb {items} />Separators
Four separator styles: chevron (default), slash, dot, arrow.
chevron
slash
dot
arrow
<Breadcrumb {items} separator="chevron" />
<Breadcrumb {items} separator="slash" />
<Breadcrumb {items} separator="dot" />
<Breadcrumb {items} separator="arrow" />With Icons
Add an icon SVG path string to any item to display an icon before the label.
const items: BreadcrumbItem[] = [
{ label: 'Home', href: '/', icon: ICONS.home },
{ label: 'Analytics', href: '#', icon: ICONS.chart },
{ label: 'Q4 Report' },
];
<Breadcrumb {items} separator="chevron" />Item Styles
The itemStyle prop controls the appearance of the current page item: plain, soft, or pill.
plain
soft
pill
<Breadcrumb items={settingsPath} itemStyle="plain" />
<Breadcrumb items={settingsPath} itemStyle="soft" />
<Breadcrumb items={settingsPath} itemStyle="pill" />Sizes
sm, md (default), lg.
sm
md
lg
Collapse Long Paths
Set maxVisible to truncate middle items. Click the ... ellipsis to expand them.
Collapsed — maxVisible=3 (click ... to expand)
Full path — no maxVisible
<!-- Collapse to 3 visible items; click ··· to expand -->
<Breadcrumb items={longPath} maxVisible={3} />Dynamic — Click to Navigate
Breadcrumb updates reactively as you navigate between pages.
Use Case — Dashboard Topbar
Breadcrumb placed in a topbar alongside a page title and action buttons.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
items | BreadcrumbItem[] | — | Required. Array of breadcrumb steps. Each item: { label: string; href?: string; icon?: string }. The last item is treated as the current page. |
separator | 'slash' | 'chevron' | 'dot' | 'arrow' | 'chevron' | Separator rendered between items. |
size | 'sm' | 'md' | 'lg' | 'md' | Text and icon size. |
itemStyle | 'plain' | 'soft' | 'pill' | 'plain' | Visual style applied to the current (last) item. |
maxVisible | number | 0 | Maximum number of items to show. When exceeded, middle items collapse into a clickable ellipsis. 0 means show all. |
class | string | undefined | Extra CSS classes for the root nav element. |