Skip to content

Breadcrumb ​

Shows the page hierarchy path; the last item is the current page (aria-current="page").

Basic usage ​

Basic usage

Item icons ​

Set the icon field on an items entry to render a leading icon (same registry as oas-icon).

Item icons

Custom separator ​

separator accepts any text; when the value matches an icon registry name it renders as an icon separator (e.g. chevron-right).

Text separator

Icon separator

Per-item separator ​

The separator field on an items entry overrides the separator after that item (icon names supported too).

Per-item separator

Items with href render as native <a> links: clicks do not block the default behavior (native navigation) and still fire oas-select (SPA hosts may intercept for routing). target opens in a new window; _blank automatically adds noopener noreferrer.

Real links

Nothing clicked

Click event ​

The oas-select event: detail: { value: href }. This example uses href="#" placeholders so clicks show feedback without navigating.

Click event

Nothing clicked

Disabled items ​

An item with disabled: true renders as non-interactive text (aria-disabled="true"); clicks do not fire events.

Disabled items

Collapse mode ​

collapsed + max-items: when there are more items than max-items (default 4), the middle items collapse into …; click … to expand a dropdown with all collapsed items .

Collapse mode

Nothing clicked

Collapse retention ​

items-before-collapse / items-after-collapse control how many items stay visible before and after the collapse ellipsis (defaults: 1 before, max-items - 2 after).

Collapse retention

Custom ellipsis ​

collapse-text replaces the default … text of the collapse ellipsis.

Custom ellipsis

Collapse expand event ​

Clicking the collapse ellipsis to expand the dropdown fires oas-collapse-click with detail: { collapsedItems } (the original array of collapsed items) — hosts can draw their own collapse panel; collapsing does not fire it.

Collapse expand event (oas-collapse-click)

Not expanded yet

Declarative child channel ​

Besides the items JSON, you can write items declaratively with <oas-breadcrumb-item> (the items attribute wins when explicitly set). The default slot text is the label; attributes map to the items fields: href/target/icon/disabled/max-width/separator/dropdown/active. Child additions/removals, attribute and text changes re-render automatically.

Child channel basic

HomeComponentsBreadcrumb

With icons and attributes

HomeComponents (new tab)DeprecatedA rather long breadcrumb item title

Custom separators (child channel) ​

Place <oas-breadcrumb-separator> between two items; its content can be arbitrary nodes (text / icon / inline elements). The per-item separator attribute accepts text or icon names, and a slot="separator" child element accepts arbitrary nodes.

Standalone separator element

Home→Components›Breadcrumb

Per-item separator (attribute / slot)

HomeComponents·Breadcrumb

Hierarchy indentation visual ​

The breadcrumb is flat by default; a pure-CSS trick can produce an indented "level" look (hide separators + indent items in order — no API involved). Idea: make ::part(nav) vertical, hide ::part(separator), and increase padding-left on ::part(item):nth-child() by occurrence order.

Hierarchy indentation (pure CSS)

Item with dropdown (oas-dropdown combo) ​

The dropdown attribute on oas-breadcrumb-item turns the item into a dropdown trigger (link-list menu; selecting an item fires oas-select). Combined with oas-dropdown you get richer menu content; selections from both channels can feed one shared state.

Item with dropdown

HomeMoreBreadcrumb
oas-dropdown combo menu
Nothing selected

Single-line ellipsis ​

ellipsis: the breadcrumb never wraps; link text is truncated with an ellipsis when the container is narrow, and links keep the full title (hover to see the complete name).

Single-line ellipsis

Per-item width truncation ​

max-item-width (px) truncates each item globally with an ellipsis + title tooltip; the maxWidth field overrides per item.

Per-item width truncation

Sizes ​

size presets: small / medium (default) / large.

Sizes

Item dropdowns ​

The dropdown array on an items entry turns that item into a dropdown trigger (click to expand; selecting a menu item fires oas-select).

Item dropdowns

Nothing clicked

Clickable last item / current semantics ​

  • active: true on an item explicitly marks it as current (aria-current="page" moves there); other items with href remain clickable.
  • active-last: the last (current) item stays clickable even with href, while keeping aria-current="page".

Explicit active

Clickable last item (active-last)

Nothing clicked

Keyboard arrow navigation ​

With focus on any link or the ellipsis button, ← / → cycle focus across items; Home / End jump to the first/last. Esc closes an open dropdown trigger.

Keyboard navigation

Color variants ​

color sets the semantic color of the current item and link hover (primary / success / warning / danger / info); colors come from tokens (dark variants included).

Color variants

Underline variant ​

variant="underline": links and the current item are permanently underlined.

Underline variant

Structured data ​

The component injects schema.org BreadcrumbList JSON-LD into the host's light DOM (<script type="application/ld+json">, only items with href), giving search engines a breadcrumb trail without handwritten microdata.

Structured data

View page source: a script[data-oas-breadcrumb-ld] already exists inside the host.

Edge cases ​

Empty data

Font Size ​

Font size follows the outer context (inherited) by default; override with the CSS variable --oas-breadcrumb-font (e.g. 18px).

API ​

oas-breadcrumb ​

Attributes ​

AttributeDescriptionTypeDefault
active-lastKeep the last item clickable: when the current (last) item has href, render it as a link (still carrying aria-current="page")boolean—
collapse-textCustom text for the collapse ellipsis (default …)string…
collapsedCollapse mode: when there are more items than max-items, middle items collapse into …; click to expand the dropdownboolean—
colorVisual variant: the current item and link hover use the specified semantic color (primary/success/warning/danger/info)string—
ellipsisSingle-line ellipsis: the breadcrumb never wraps; overflowing link text is truncated with an ellipsisboolean—
itemsBreadcrumb items JSON: label/href/icon/disabled/target/separator/dropdown/maxWidth/activestring[]
items-after-collapseNumber of items kept after the collapse ellipsis (default max-items - 2)string—
items-before-collapseNumber of items kept before the collapse ellipsis (default 1)string—
max-item-widthGlobal max width per item (px): overflow is truncated with an ellipsis + title tooltip; per-item maxWidth overridesstring—
max-itemsMaximum number of visible items in collapse mode (including …); invalid values fall back to 4string4
separatorSeparator (supports icon names, e.g. chevron-right)string/
sizeSize preset: small/medium (default)/largestringmedium
variantStyle variant: underline (links and the current item are permanently underlined)string—

Events ​

EventDescription
oas-collapse-clickFired when the collapse ellipsis is clicked to expand the dropdown (not fired when collapsing), detail: { collapsedItems } (the original array of collapsed items, for hosts that want a custom collapse panel)
oas-selectA link item, a collapsed dropdown item, or an item dropdown item was clicked; detail: { value: href } (real links do not block default navigation; hosts may intercept for routing)

Slots ​

NameDescription
separatorCustom separator content (text or icon; replaces the separator attribute)

CSS Variables ​

CSS VariableDefault
--oas-breadcrumb-fontinherit

oas-breadcrumb-item ​

Attributes ​

AttributeDescriptionTypeDefault
activeExplicitly mark this item as current (aria-current="page"); defaults to the last item——
disabledDisabled item: rendered as non-interactive text (aria-disabled)——
dropdownLink-list dropdown for the item (JSON, e.g. [{"label":"Child","href":"/a"}]); the item renders as a dropdown trigger——
hrefLink URL: with href the item renders as a native <a> (real navigation + still fires oas-select)——
iconLeading icon (@oas-ui/icons registry icon name)——
max-widthPer-item max width (px): overflow is truncated with an ellipsis + title tooltip——
separatorPer-item separator: overrides the global separator (text or icon name); a slot="separator" child element also accepts arbitrary nodes——
targetLink target (_blank automatically adds noopener noreferrer)——

Slots ​

NameDescription
defaultBreadcrumb item label content (default slot text)

oas-breadcrumb-separator ​

Slots ​

NameDescription
defaultSeparator content: arbitrary nodes (text / icon / inline elements)

nav + aria-label="Breadcrumb", the last item has aria-current="page" and is not clickable.

Released under the MIT OR Apache-2.0 License.