Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

A simple trail

The trail runs root first with the current page last, and the last crumb is never a link.

Root to current page
Show code
<app-breadcrumbs>
    <app-breadcrumb label="Projects" href="/projects" />
    <app-breadcrumb label="Acme Corp" href="/projects/acme" />
    <app-breadcrumb label="Invoices" />
</app-breadcrumbs>

A leading icon

A house icon on the root crumb shows where the trail starts, and it is the common case.

Home, with an icon
Show code
<app-breadcrumbs>
    <app-breadcrumb icon="house" label="Home" href="/" />
    <app-breadcrumb label="Projects" href="/projects" />
    <app-breadcrumb label="Acme Corp" />
</app-breadcrumbs>

A one-line trail on a phone

Below md, max-items keeps the last crumbs on one line and puts the rest in an ellipsis menu.

Collapsed below md
Show code
<app-breadcrumbs max-items="2">
    <app-breadcrumb icon="house" label="Home" href="/" />
    <app-breadcrumb label="Projects" href="/projects" />
    <app-breadcrumb label="Acme Corp" href="/projects/acme" />
    <app-breadcrumb label="Invoices" />
</app-breadcrumbs>

Router-decoupled links

Razor has no client-side router to decouple from, so a crumb's href is a plain link and each click loads a full page. The linkComponent form is React only.

Every option

Every value of every prop, one cell each.

icon

icon on the root crumb
icon on every crumb
icon on the current page (last crumb)
(no icon, default)

the current page (last item)

href on the last item is ignored
a single-crumb trail: only the current page
no app-breadcrumb children: an empty <ol>

a long trail, not collapsed by default

eight levels deep, wraps onto a new line while max-items is unset

linkComponent: router-decoupled (React only)

to with linkComponent (React only): Razor uses href, a full page load
href: the only link form on Razor, a plain anchor

max-items

(default) no max-items: the whole trail shows
max-items="2": below md, the last two crumbs, the rest in an ellipsis menu

more-label

(default) more-label: "Show hidden levels"
more-label="Show more levels": names the ellipsis button, shown below md

class

class="my-trail": adds your own classes to the trail (React: className)

Guidance

What to do, and what to avoid.

Use it when

  • The page sits several levels deep in a hierarchy the user might want to step back through.
  • You want to state, unambiguously, where the current page is in that hierarchy.
  • The trail is short: a handful of levels, not a full site map.

Reach for something else when

  • The user is switching between peer views of the same record. → AppTabs
  • You need the app's persistent primary navigation. → AppShell
  • The flow is a sequence of steps to complete, not a place in a hierarchy. → AppStepper

Current page as plain text

Do

Short labels, a real link on every ancestor, and the current page as plain text.

Avoid

The current page still looks like the others. AppBreadcrumbs already prevents this by ignoring href on the last item, so this shape only happens if you fight the component.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

2 crumbs 3 crumbs 4 crumbs 6 crumbs
(none) house building settings users
true false
React, generated from the controls
<AppBreadcrumbs
  items={[
    { label: 'Home', href: '/home' },
    { label: 'Projects', href: '/projects' },
    { label: 'Acme Corp' },
  ]}
/>
Razor, the same props
<app-breadcrumbs>
    <app-breadcrumb label="Home" href="/home" />
    <app-breadcrumb label="Projects" href="/projects" />
    <app-breadcrumb label="Acme Corp" />
</app-breadcrumbs>

7 props. The 3 most used come first.

Used on most screens 3 props

PropTypeDefaultDescription
max-itemsdefault - int - Below md, show only the last this many crumbs, with an ellipsis menu holding the rest. A whole number of 1 or more. Unset shows the whole trail.
more-labeldefault Show hidden levels string Show hidden levels The accessible name of the ellipsis button.
wrapdefault true bool true false keeps the trail on one line; items do not wrap.

Less common 4 props

PropTypeDefaultDescription
icondefault - string - Library icon name for a leading glyph.
labeldefault - string - The crumb's text.
hrefdefault - string - Makes the crumb a link. Ignored on the last crumb; it always renders as text.
to / linkComponentdefault - - - Razor has no client-side router to decouple from: use href, which causes a full page navigation.

Screen reader

3 notes
  • The last item is the current page: it is text with aria-current page, never a link, unless the trail sits in a bar page header, where every crumb is a parent link.
  • An item with no target renders as a plain span, so it is never announced as a button with no link.
  • With maxItems, the hidden crumbs sit in an ellipsis menu below md, reachable by keyboard like any dropdown.

Do and avoid

1 pairs

Current page as plain text

Do

Short labels, a real link on every ancestor, and the current page as plain text.

Avoid

The current page still looks like the others. AppBreadcrumbs already prevents this by ignoring href on the last item, so this shape only happens if you fight the component.