icon

Morainev0.5.0

Breadcrumb
navigationbreadcrumb

Breadcrumb

Breadcrumb navigation trail with separator icons and optional wrapping.

Import#

import { Breadcrumb } from 'moraine'

Slot Structure#

Ordered navigation list with links and separators between items.

root
└── list
└── item (×n)
├── link
└── separator (optional, between items)

Examples#

Default#

Simple breadcrumb trail with active last item.

function Default() {
const DEFAULT_ITEMS = [
{ label: 'Home', href: '#', icon: 'i-lucide:house' },
{ label: 'Library', href: '#', icon: 'i-lucide:folder' },
{ label: 'Components', href: '#', icon: 'i-lucide:box' },
{ label: 'Breadcrumb', href: '#', icon: 'i-lucide:bell-ring', active: true },
]
return <Breadcrumb items={DEFAULT_ITEMS} />
}

Sizes#

Different size.

function Sizes() {
return (
<div class="flex flex-col gap-4">
<Breadcrumb
size="sm"
items={[
{ label: 'Workspace', href: '#', icon: 'i-lucide:briefcase' },
{ label: 'Settings', href: '#', icon: 'i-lucide:settings' },
{ label: 'Danger Zone', href: '#', disabled: true, icon: 'i-lucide:triangle-alert' },
]}
/>
<Breadcrumb
size="lg"
items={[
{ label: 'Workspace', href: '#', icon: 'i-lucide:briefcase' },
{ label: 'Settings', href: '#', icon: 'i-lucide:settings' },
{ label: 'Danger Zone', href: '#', disabled: true, icon: 'i-lucide:triangle-alert' },
]}
/>
</div>
)
}

Custom Separator + Disabled#

Use an alternative separator and mark links as disabled.

function CustomSeparatorDisabled() {
return (
<Breadcrumb
separator={() => '/'}
classes={{
separator: 'size-unset',
}}
items={[
{ label: 'Workspace', href: '#', icon: 'i-lucide:briefcase' },
{ label: 'Settings', href: '#', icon: 'i-lucide:settings' },
{ label: 'Danger Zone', href: '#', disabled: true, icon: 'i-lucide:triangle-alert' },
]}
/>
)
}

Wrapping#

Toggle wrapping behavior for long breadcrumb labels.

function Wrapping() {
const [wrap, setWrap] = createSignal(true)
return (
<div class="space-y-3">
<Button onClick={() => setWrap((value) => !value)}>
Wrap: {wrap() ? 'enabled' : 'disabled'}
</Button>
<div class="max-w-md">
<Breadcrumb
wrap={wrap()}
items={[
{ label: 'Very long section name that can wrap', href: '#' },
{ label: 'Another long nested section title', href: '#' },
{ label: 'Current page with long title', href: '#', active: true },
]}
/>
</div>
</div>
)
}

API Reference#

Attributes#

Slotroot5 attributes
Navigation container for the breadcrumb trail.

Data Attributes

3
Data AttributeDescription
data-orientation
Stores the rendered orientation.
data-size
Stores the resolved size variant.
data-variant
Stores the resolved visual variant.

ARIA Attributes

2
ARIA AttributeDescription
aria-label
Provides an accessible label when visible text is not sufficient.
role
Defines the semantic role exposed to assistive technology.

Props#

PropTypeDefaultDescription
classClassValue
Class applied to the component root or trigger element.
classesBreadcrumbT.Classes | undefined
itemRenderComponentOrElement<BreadcrumbT.ItemRenderProps> | undefined
Custom renderer for individual breadcrumb items.
itemsBreadcrumbT.Item[] | undefined
Array of breadcrumb items to display.
refJSX.HTMLElementTags["nav"] extends { ref?: infer Ref; } ? Ref : never | undefined
separatorIconT.Nameicon-chevron-right
Icon name for the separator between items.
size"xs" | "sm" | "md" | "lg" | "xl" | undefinedmd
Size of the breadcrumb items and icons.
styleJSX.CSSProperties | undefined
stylesBreadcrumbT.Styles | undefined
wrapboolean | undefined

Items#

An individual item in the breadcrumb trail.
PropTypeDefaultDescription
activeboolean | undefined
Whether the item is the current active page.
disabledboolean | undefined
Whether the item is disabled.
hrefstring | undefined
The destination URL for this item.
iconIconT.Name
Icon to display next to the label.
labelJSX.Element
Label to display for the breadcrumb item.
onClickJSX.EventHandlerUnion<HTMLAnchorElement, MouseEvent> | undefined
Callback when the item is clicked.
relstring | undefined
Relationship of the linked URL to the current document.
targetstring | undefined
Where to display the linked URL.
tostring | undefined
The destination URL for this item.