Breadcrumb for Astro
Astro navigation links that show a page’s position in a site.
Installation
bunx --bun shadcn@latest add @gnostic/breadcrumbnpx shadcn@latest add @gnostic/breadcrumbpnpm dlx shadcn@latest add @gnostic/breadcrumbCopy the files
src/components/ui/breadcrumb/types.tssrc/components/ui/breadcrumb/breadcrum-menu.astrosrc/components/ui/breadcrumb/breadcrumb-ellipsis.astrosrc/components/ui/breadcrumb/breadcrumb-item.astrosrc/components/ui/breadcrumb/breadcrumb-link.astrosrc/components/ui/breadcrumb/breadcrumb-list.astrosrc/components/ui/breadcrumb/breadcrumb-page.astrosrc/components/ui/breadcrumb/breadcrumb-separator.astrosrc/components/ui/breadcrumb/breadcrumb.astrosrc/components/ui/breadcrumb/index.ts
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
BreadcrumbMenuProps
: 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.