GooseUI

Components

Breadcrumb


Breadcrumb shows the current location within a hierarchy. It is a labelled navigation landmark with an ordered list. Separators are drawn by CSS between items, so BreadcrumbSeparator is optional. On a narrow screen the list scrolls horizontally instead of wrapping, and its edges fade out where there is more to scroll. No JavaScript, the component stays a server component.

Browser Support

Scroll-driven animations

Drives the edge fade from the list's own scroll position. Where it is not supported the list still scrolls, just without the fade.

Your browser:

Preview

Installation

npx shadcn@latest add @gooseui/breadcrumb
pnpm dlx shadcn@latest add @gooseui/breadcrumb
yarn dlx shadcn@latest add @gooseui/breadcrumb
bunx --bun shadcn@latest add @gooseui/breadcrumb

Usage

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

export default function Example() {
  return (
    <Breadcrumb>
      <BreadcrumbList>
        <BreadcrumbItem>
          <BreadcrumbLink href="/">Home</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbLink href="/docs">Docs</BreadcrumbLink>
        </BreadcrumbItem>
        <BreadcrumbItem>
          <BreadcrumbPage>Components</BreadcrumbPage>
        </BreadcrumbItem>
      </BreadcrumbList>
    </Breadcrumb>
  )
}

Examples

Separators

separator picks the glyph drawn between items: chevron (default), slash, dot or arrow. Set it on Breadcrumb or on BreadcrumbList, the list wins. The glyph takes the text colour and flips in right-to-left layouts.

<Breadcrumb separator="slash">…</Breadcrumb>

// or on the list itself
<BreadcrumbList separator="dot">…</BreadcrumbList>

Pill variant

Items become pills with a light fill on hover. The current page sits on a bg-muted pill in font-medium.

<Breadcrumb variant="pill" separator="slash">
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink href="/">Home</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbItem>
      <BreadcrumbLink href="/docs">Docs</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbItem>
      <BreadcrumbPage>Components</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>

Home icon

A link is an inline flex box, so an icon and a label sit side by side. Give an icon-only link an aria-label.

import { House } from "lucide-react"

<BreadcrumbItem>
  <BreadcrumbLink href="/">
    <House className="size-4" />
    Home
  </BreadcrumbLink>
</BreadcrumbItem>

// icon only: add an accessible name
<BreadcrumbLink href="/" aria-label="Home">
  <House className="size-4" />
</BreadcrumbLink>

Ellipsis

BreadcrumbEllipsis stands in for the collapsed middle of a long path.

<BreadcrumbItem>
  <BreadcrumbEllipsis />
</BreadcrumbItem>

Long path

The list never wraps: it scrolls sideways, and the edges fade out only on the side that has more content. The current page is cut with an ellipsis when it does not fit, and a Hint shows the full name on hover. Resize the container below or use a phone.

<div className="w-72">
  <Breadcrumb>
    <BreadcrumbList>
      {/* …many items… */}
      <BreadcrumbItem>
        {/* Hint shows the full name on hover */}
        <Hint
          content="A page with a really long title that never fits"
          side="bottom"
        >
          <BreadcrumbPage>
            A page with a really long title that never fits
          </BreadcrumbPage>
        </Hint>
      </BreadcrumbItem>
    </BreadcrumbList>
  </Breadcrumb>
</div>

Explicit separators

Existing markup with BreadcrumbSeparator keeps working. An item that follows an explicit separator gets no drawn one, so nothing is doubled.

<BreadcrumbItem>…</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>…</BreadcrumbItem>

Props

PropTypeDefaultDescription
separator"chevron" | "slash" | "dot" | "arrow""chevron"Glyph drawn between items. Not needed when BreadcrumbSeparator is used. On Breadcrumb or BreadcrumbList; the list value wins.
variant"default" | "pill""default"Visual style. pill turns items into rounded pills. On Breadcrumb or BreadcrumbList; the list value wins.
classNamestring-Additional CSS classes.