Navigation

Breadcrumb

Display a navigation trail showing the user's current location within the site hierarchy. Supports icons, custom separators, and fully custom item rendering.

Playground

Experiment with different props in real-time.

Basic Usage

Pass an array of items. The last item (without href) renders as the active page.

<script lang="ts">
  import { Breadcrumb } from 'sv5ui';

  const items = [
    { label: 'Home', href: '/' },
    { label: 'Components', href: '/docs/components' },
    { label: 'Breadcrumb' }
  ];
</script>

<Breadcrumb {items} />

With Icons

Add leading icons to each item.

<Breadcrumb items={[
  { label: 'Home', href: '/', icon: 'lucide:house' },
  { label: 'Settings', href: '/settings', icon: 'lucide:settings' },
  { label: 'Profile', icon: 'lucide:user' }
]} />

Separator Icons

Change the separator icon globally.

<Breadcrumb {items} separatorIcon="lucide:chevron-right" />
<Breadcrumb {items} separatorIcon="lucide:slash" />
<Breadcrumb {items} separatorIcon="lucide:dot" />
<Breadcrumb {items} separatorIcon="lucide:minus" />
<Breadcrumb {items} separatorIcon="lucide:arrow-right" />

Disabled Items

Disable individual breadcrumb items.

<Breadcrumb items={[
  { label: 'Home', href: '/' },
  { label: 'Archived', href: '/archived', disabled: true },
  { label: 'Detail' }
]} />

Long Path

Deep navigation trails with many levels.

<Breadcrumb items={[
  { label: 'Home', href: '/', icon: 'lucide:house' },
  { label: 'Products', href: '/products' },
  { label: 'Electronics', href: '/products/electronics' },
  { label: 'Phones', href: '/products/electronics/phones' },
  { label: 'iPhone 16 Pro' }
]} />

Custom Separator

Use the separator snippet for fully custom separators.

<Breadcrumb {items}>
  {#snippet separator()}
    <span class="text-on-surface/30 mx-1">/</span>
  {/snippet}
</Breadcrumb>

Custom Item

Use the item snippet to fully customize each breadcrumb.

<Breadcrumb {items}>
  {#snippet item({ item, index, active })}
    <span
      class="rounded-full px-3 py-1 text-sm font-medium
        {active
          ? 'bg-primary text-on-primary'
          : 'bg-surface-container text-on-surface/60 hover:bg-surface-container-high'}"
    >
      {item.label}
    </span>
  {/snippet}
</Breadcrumb>

UI Slots

Use the ui prop to override classes on internal elements.

SlotDescription
rootRoot nav element — controls wrapper styles
listOrdered list element — controls list layout and spacing
itemList item element — controls individual item wrapper
linkAnchor/span element — controls link appearance and hover states
linkLeadingIconIcon before label inside link
linkLabelText label inside link
separatorSeparator wrapper — controls spacing
separatorIconSeparator icon element
<Breadcrumb
  {items}
  ui={{
    root: 'bg-surface-container rounded-lg px-4 py-2',
    link: 'font-semibold',
    separatorIcon: 'text-primary'
  }}
/>

Snippets

SnippetPropsDescription
itemitem, index, activeCustom render for each breadcrumb item
separator-Custom separator between items

Props

PropTypeDefault
itemsBreadcrumbItem[]-
separatorIconstring'lucide:chevron-right'
askeyof HTMLElementTagNameMap'nav'
refHTMLElement | nullnull
classstring-
uiRecord<Slot, Class>-

Item Props

PropTypeDefault
labelstring-
hrefstring-
iconstring-
disabledbooleanfalse
classstring-