Navigation

Breadcrumbs

Hierarchical wayfinding trail showing the ancestor path of the current page with the final entry marked as aria-current.

import { Breadcrumbs } from '@lostgradient/cinder';
navigationwayfinding
01

Overview

Reference usage

A navigation trail that shows the current page's position in a hierarchy.

Usage

svelte
<script lang="ts">
  import { Breadcrumbs } from '@lostgradient/cinder';
</script>

<Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Docs' }]} />

Phone form

Below collapseBelow (640px by default) the trail collapses to a back link labelled with the parent, then the current page, which truncates first. The back link is a real link with the accessible name "Back to Runs" (backLabel words it), at least 44px tall. A trail with one entry shows just that entry, and collapseBelow={false} keeps the whole trail at every width. The choice is made in script from the viewport, so the ancestors that are not shown are not in the page.

A long current page

Give the last item a popover and it draws as a bordered button with a chevron that truncates its label with an ellipsis at 300px. popover: true fills the popover with the full label, which is what a long chat title needs; a snippet fills it with anything else.

svelte
<script lang="ts">
  import { Breadcrumbs } from '@lostgradient/cinder';
</script>

<Breadcrumbs
  separator="›"
  items={[
    { label: 'Chat', href: '/chat' },
    { label: 'A very long chat title …', popover: true },
  ]}
/>
Live preview

Basic breadcrumbs

02

When to use

Use when
  • Surfacing where the user sits inside a deep, nested hierarchy.
  • Letting the user jump back to any ancestor view in one click.
Avoid when
  • Switching between sibling sections at the same level — use navigation-bar or tabs.
  • Showing an ordered task progression — use steps instead.
03

Examples

Basic breadcrumbs

Navigation trail with the final entry as the current page.

Custom separator

Override the default "/" separator with any string or snippet.

Phone form and a long current page

Below collapseBelow (640px by default) the trail is a back link labelled with the parent ("Back to Chat") and the current page, which truncates first. A popover on the current page draws it as a button that truncates at 300px and keeps the full title in the popover. This example sets collapseBelow wide enough to show the phone form at any width.

04

Props

Props for breadcrumbs
Name
Type
Default
Description
items required BreadcrumbItem[] Ordered list of breadcrumb entries from root to current page.
separator text '/' Custom separator between entries. Defaults to "/".
label text 'Breadcrumb' Accessible name for the nav landmark. Defaults to "Breadcrumb".
collapseBelow text '640px' Viewport width below which the trail collapses to its phone form: a back link labelled with the parent ("Runs") followed by the current page, which truncates first. A trail with a single entry shows just that entry. A simple CSS length such as '640px', or false to always show the whole trail. Default '640px'.
backLabel text 'Back to {label}' Accessible name of the phone back link; {label} is replaced by the parent's label. Default "Back to {label}".
maxVisible number How many ancestors (every entry before the current page) show before the rest fold into a leading "…" button that lists them in a menu. Left unset, a trail shows every ancestor until its container is narrower than 24rem, where one ancestor shows (the current page's parent): an ancestor that cannot show its full first word is left out with its separator, never squeezed to a fragment. A number applies at every width, and 0 folds every ancestor.
overflowLabel text 'Show earlier pages' Accessible name of the "…" button that opens the hidden ancestors. Default "Show earlier pages".
onOverflowNavigate (item: BreadcrumbItem, event: MouseEvent) => void Called when a link in the hidden-ancestors menu is clicked, with the entry it opens. Call event.preventDefault() to open the page without a reload, as an application's router does. The menu renders in a portal, outside the trail's own element, so a click handler on the trail never sees these links.