Skip to main content

BreadCrumb

BreadCrumb renders a navigation trail. When there are more items than maxItems, the middle items collapse into an overflow menu so the trail never wraps or overflows its container. Separators, item rendering, and theming are all customizable.

When to use

  • Show the user's location in a hierarchy (site → library → folder → file).
  • Any navigation path that must stay on one line regardless of depth.

Import

import { BreadCrumb } from '@spartanfx/react';

Basic usage

Pass items, each with an id and label (and optional href, icon, disabled).

<BreadCrumb
items={[
{ id: 'home', label: 'Home', href: '/' },
{ id: 'projects', label: 'Projects', href: '/projects' },
{ id: 'alpha', label: 'Project Alpha' },
]}
onItemClick={(item) => navigate(item.href)}
/>

Overflow handling

Cap the visible items with maxItems. Items beyond the cap collapse into a menu; itemsBeforeCollapse / itemsAfterCollapse control how many stay pinned at each end.

<BreadCrumb
items={deepTrail}
maxItems={4}
itemsBeforeCollapse={1}
itemsAfterCollapse={2}
overflowLabel="More"
/>

Custom separator

<BreadCrumb items={items} separator="" />

Key props

PropTypeDefaultNotes
items (required)IBreadCrumbItem[]id + label, plus optional href, icon, disabled, data.
maxItemsnumberInfinityItems shown before overflow collapses.
itemsBeforeCollapse / itemsAfterCollapsenumber1 / 1Items pinned at start / end.
separatorReactNode'/'Separator between items.
onItemClick(item, event) => voidFires when an item is clicked.
appearanceAppearanceModelightLight or dark theming.

See the full generated reference: BreadCrumb API ↗.

See also