Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Breadcrumb for Astro

Astro navigation links that show a page’s position in a site.

Installation

bunx --bun shadcn@latest add @gnostic/breadcrumb

Usage

import {
    Breadcrumb,
    BreadcrumbEllipsis,
    BreadcrumbItem,
    BreadcrumbLink,
    BreadcrumbList,
    BreadcrumbPage,
    BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
<Breadcrumb>
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink href="/">Home</BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbPage>Current Page</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>

Composition

Arrange the parts as shown for a Breadcrumb:

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

Examples

Basic

With Menu

The ellipse can be a trigger for a dropdown menu, to truncate the breadcrumb trail, while preserving the full trail in a menu.

API Reference

Could not generate a type table for : No interface or type named "undefined" found.

When to use Breadcrumb

Build a Breadcrumb from list items and links ordered from the parent section to the current page. Use BreadcrumbPage for the final item. The trail describes the site hierarchy; it does not need to reproduce browser history.

Keyboard and behavior

Links retain native keyboard and browser behavior. Name multiple navigation regions so users can tell them apart. Separators are visual punctuation and should not add extra spoken content.

Theme and layout

Muted text and hover styles follow the theme. Let long labels wrap or shorten them with meaningful wording. An ellipsis only displays a gap; add a menu yourself if hidden ancestors must be available.