Layout

Breadcrumb

shadcn primitives and layout route breadcrumbs for dashboard shells, i18n, and detail pages.

Breadcrumbs help users orient themselves in nested apps. Feature Kits ships two layers:

  • ui Breadcrumb* — accessible primitives (list, links, current page, separator, ellipsis).
  • layout Breadcrumbs — route-derived trail for dashboard headers (compression, tooltips, copy URL, dynamic ?name= labels).

Patterns below mirror production apps (dashboard headers, settings, data tables, auth, and mobile nav).

Installation

Registry CLI

Requires a one-time components.json registry entry for @feature-kit/breadcrumb.

pnpm dlx shadcn@latest add https://feature-kits.vercel.app/r/breadcrumb.json

Namespaced: npx shadcn@latest add @feature-kit/breadcrumb

Manual installation

Monorepo consumers can depend on workspace:* packages instead of the registry CLI.

pnpm add layout ui

Dependencies

// apps/your-app/package.json
"dependencies": {
    "layout": "workspace:*"
    "ui": "workspace:*"
}

Transpile (Next.js)

// next.config.ts
transpilePackages: ["layout", "ui"]

Import

import { Breadcrumbs, BreadcrumbsSkeleton } from "layout"
import {
Breadcrumb,
BreadcrumbEllipsis,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"

Mount Breadcrumbs in a client layout with next-intl messages for breadcrumb.* keys.

Anatomy

import {
  Breadcrumb,
  BreadcrumbEllipsis,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/packages/ui/components/breadcrumb"
import { Breadcrumbs, BreadcrumbsSkeleton } from "layout"
import { compressBreadcrumbs, generateBreadcrumbs, resolveCrumbLabel } from "layout/breadcrumb"
<Breadcrumb>
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink href="/">Home</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbPage>Current</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>

{/* App shell */}
<DashboardHeader showBreadcrumbs actions={actions} />

Examples

Basic

Custom separator

With icons

Collapsed / ellipsis (deep paths)

Hidden segments open in a menu (same pattern as the layout Breadcrumbs component).

Current page

Responsive truncation (mobile)

Use cases

Route-based breadcrumbs in the dashboard shell

Mount DashboardHeader in DashboardShell — crumbs read the active pathname (bad-money / ai-chat style).

Actions
Route-derived crumbs in the shell header (current docs path).

Dynamic segments (?name=)

Detail routes use resolveCrumbLabel so /accounts/[id] shows the account name from ?name=.

Loading skeleton

Swap in BreadcrumbsSkeleton while the entity name resolves.

Loading account name…

i18n ([lang] prefixes)

Pass locale so the home crumb targets /en (or your next-intl prefix).

Nested settings

Long settings paths stay readable; compression kicks in after three segments.

Data table → detail → edit

List

Detail

Edit

Auth routes (hidden)

Disable crumbs on sign-in and marketing auth layouts.

Auth routes: no breadcrumb trail in the header.

Mobile nav truncation

Use display="inline" and min-w-0 inside the sheet header.

Mobile sheet header: crumbs use min-w-0 and truncate inside the nav bar.

Live path on this page

Component API

Breadcrumb
PropTypeDescription
classNamestringOptional nav wrapper classes.
...propsReact.ComponentProps<'nav'>Forwarded to the root <nav>.
BreadcrumbList
PropTypeDescription
classNamestringList layout; default flex wrap with gap-1.5.
...propsReact.ComponentProps<'ol'>Ordered list of items.
BreadcrumbItem
PropTypeDescription
classNamestringInline flex item wrapper.
...propsReact.ComponentProps<'li'>Single crumb cell.
BreadcrumbLink
PropTypeDescription
asChildbooleanCompose with next/link or router Link.
classNamestringHover styles for ancestors.
...propsReact.ComponentProps<'a'>Anchor props when asChild is false.
BreadcrumbPage
PropTypeDescription
classNamestringCurrent page text styles.
...propsReact.ComponentProps<'span'>Sets aria-current="page" on the current crumb.
BreadcrumbSeparator
PropTypeDescription
childrenReactNodeCustom separator; defaults to ChevronRightIcon.
classNamestringSeparator spacing.
...propsReact.ComponentProps<'li'>role="presentation" aria-hidden.
BreadcrumbEllipsis
PropTypeDescription
classNamestringEllipsis control for collapsed menus.
...propsReact.ComponentProps<'span'>MoreHorizontal icon with sr-only "More".
Breadcrumbs
PropTypeDescription
classNamestringApplied to BreadcrumbList (truncate, flex-1).
localestringLocale prefix for home href (e.g. en → /en).
pathnamestringOverride pathname for tests/docs; defaults to usePathname().
searchParamsSearchParamsLikeOverride search params when using pathname.
display"header" | "inline"header hides below md; inline always shows (mobile nav).
BreadcrumbsSkeleton
PropTypeDescription
classNamestringSkeleton bar matching header crumb height.
DashboardHeader
PropTypeDescription
showBreadcrumbsbooleanSet false on auth/marketing routes.
showSidebarTriggerbooleanSidebar trigger + separator.
actionsReactNodeRight-side header actions (theme, user menu).
classNamestringShell header classes.

Route helpers (layout/breadcrumb)

generateBreadcrumbs
PropTypeDescription
pathnamestringCurrent pathname (leading slash).
searchParamsSearchParamsLike | nullOptional query for ?name= labels.
compressBreadcrumbs
PropTypeDescription
itemsCrumb[]Returns visible nodes plus hidden crumbs for the ellipsis menu.
resolveCrumbLabel
PropTypeDescription
segmentstringURL segment.
options{ segmentIndex, segments, searchParams? }Resolves ?name= on entity segments.

Accessibility

  • The root Breadcrumb renders <nav aria-label="breadcrumb"> (shadcn default).
  • BreadcrumbPage sets aria-current="page" on the current crumb only; ancestors remain links.
  • Separators and ellipsis use role="presentation" and aria-hidden="true" so screen readers hear the list, not punctuation.
  • Icon-only home uses sr-only text; copy-URL exposes aria-label from breadcrumb.copyUrl messages.
  • Prefer a single breadcrumb region per page; hide the shell trail on auth with showBreadcrumbs={false}.

On this page