suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
  • AI
GitHubCreate
DocsComponentsPatternsInteractionsChartsBlocksAICreate
Components84
  • Overview
  • Accordion
  • Alert
  • Alert Dialog
  • Alert Sheet
  • Amount Input
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Bottom Bar
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Chip
  • Code Block
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Direction
  • Drawer
  • Dropdown Menu
  • Empty
  • FAB
  • Field
  • Fullscreen Menu
  • Haptics
  • Header
  • Hover Card
  • Icon
  • Input
  • Input Accessory Bar
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Keyboard Scroll View
  • Keypad
  • Label
  • Marker
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Page Indicator
  • Pagination
  • Pin Pad
  • Popover
  • Progress
  • QR Scanner
  • Questionnaire
  • Radio Group
  • Resizable
  • Screen
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature Pad
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Tab Bar
  • Table
  • Tabs
  • Text
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Trace
  • Wheel Picker
  • Widget

suiss/ui · Component

Breadcrumb

A trail of links that shows where the current page sits in the site hierarchy.

Breadcrumb is an open-source component from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.

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

export default function BreadcrumbDemo() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Home</BreadcrumbLink>
        </BreadcrumbItem>

A Breadcrumb is a labelled nav that contains a BreadcrumbList. The list holds BreadcrumbItem parts separated by BreadcrumbSeparator parts. Each item contains either a BreadcrumbLink to an ancestor page or, for the last item, a BreadcrumbPage for the current page. Use BreadcrumbEllipsis inside an item to stand in for collapsed levels.

Use breadcrumbs in deep hierarchies so people can see their location and move up quickly. For top-level navigation between sections, use a navigation menu or tabs.

Installation

$ pnpm dlx shadcn@latest add @esuiss/breadcrumb

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add breadcrumb
  1. Install the following dependencies and add the cn helper:
$ pnpm add @base-ui/react @phosphor-icons/react
  1. Copy and paste the following code into your project.
components/ui/breadcrumb.tsx
"use client"

import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { CaretRightIcon, DotsThreeIcon } from "@phosphor-icons/react"
import type * as React from "react"
import { cn } from "@/lib/utils"

function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">) {
  return (
    <nav
      aria-label="breadcrumb"
      data-slot="breadcrumb"
      className={className}
      {...props}
    />
  1. Update the import paths to match your project setup.

Usage

import {
  Breadcrumb,
  BreadcrumbEllipsis,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
<Breadcrumb>
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink href="#">Home</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbLink href="#">Projects</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbPage>Website redesign</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>

Composition

Use the following composition to build a Breadcrumb:

Breadcrumb
└── BreadcrumbList
    ├── BreadcrumbItem
    │   ├── BreadcrumbLink
    │   ├── BreadcrumbPage
    │   └── BreadcrumbEllipsis
    └── BreadcrumbSeparator

Examples

With home icon

Replace the first link's text with a home icon. An icon-only link needs an aria-label.

import { HouseIcon } from "@phosphor-icons/react"
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"

export default function BreadcrumbWithHomeIcon() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink

With ellipsis

Put a BreadcrumbEllipsis inside an item to stand in for collapsed middle levels.

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

export default function BreadcrumbWithEllipsis() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Home</BreadcrumbLink>

Custom separator

Pass children to BreadcrumbSeparator to use a slash instead of the default caret.

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

export default function BreadcrumbCustomSeparator() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="#">Docs</BreadcrumbLink>
        </BreadcrumbItem>

Accessibility

  • Breadcrumb renders a nav with aria-label="breadcrumb".
  • BreadcrumbPage sets aria-current="page".
  • Separators have role="presentation" and aria-hidden="true", so only items are announced as list items.
  • BreadcrumbEllipsis hides its icon and includes visually hidden text, More by default; pass children to change it.
  • Only links are in the tab order; the ellipsis and current page are skipped.

API Reference

Breadcrumb

The nav landmark that wraps the trail.

Also accepts the props of React.ComponentProps<"nav">.

BreadcrumbList

The ordered list of items.

Also accepts the props of React.ComponentProps<"ol">.

BreadcrumbItem

A single step in the trail.

Also accepts the props of React.ComponentProps<"li">.

BreadcrumbLink

A link to an ancestor page.

Also accepts the props of useRender.ComponentProps<"a">.

BreadcrumbLink renders an a by default. Use the render prop to render your router's link component: render={<Link href="/" />}.

PropTypeDefault
asChildbooleanfalse

Also accepts the props of React.ComponentProps<"a">.

BreadcrumbLink renders an a by default. Set asChild and pass your router's link component as the child to render it instead.

PropTypeDefault
render(props: React.HTMLAttributes<HTMLElement>) => React.ReactNode—

Also accepts the props of React.ComponentProps<"a">.

BreadcrumbLink renders an a by default. Pass a render function that returns your router's link component with the props it receives.

Ancestor links use text-muted-foreground and the current page uses text-foreground.

BreadcrumbPage

The current page, rendered as plain text.

Also accepts the props of React.ComponentProps<"span">.

BreadcrumbSeparator

A decorative divider between items.

Also accepts the props of React.ComponentProps<"li">.

Place a BreadcrumbSeparator between items as its own sibling, not inside a BreadcrumbItem. It renders a caret by default, which flips in right-to-left layouts; pass children to use a different separator.

BreadcrumbEllipsis

A placeholder for collapsed levels, with a screen-reader label.

Also accepts the props of React.ComponentProps<"span">.

Each part sets a data-slot, such as breadcrumb-list or breadcrumb-ellipsis, for styling.

NextBubblePreviousBottom Bar

On this page

  1. 01Installation
  2. 02Usage
  3. 03Composition
  4. 04Examples
    • With home icon
    • With ellipsis
    • Custom separator
  5. 05Accessibility
  6. 06API Reference
    • Breadcrumb
    • BreadcrumbList
    • BreadcrumbItem
    • BreadcrumbLink
    • BreadcrumbPage
    • BreadcrumbSeparator
    • BreadcrumbEllipsis