Breadcrumb
Accessible breadcrumb primitive for route hierarchy navigation.
npx shadcn@latest add @aavya/ui-breadcrumb
One-time setup — add the @aavya registry to your components.json so branded dependencies resolve to Aavya (not stock shadcn):
"registries": { "@aavya": "https://registry-dev.aavya.com/r/{name}.json" }Or install by full URL: npx shadcn@latest add https://registry-dev.aavya.com/r/ui-breadcrumb.json
| Part | Prop | Type | Default |
|---|---|---|---|
| BreadcrumbLink | asChild? | boolean | — |
Breadcrumb forwards remaining props to all <nav> element props.
Do
- Show the path to the current page, with the current page as non-interactive text (BreadcrumbPage).
- Use the real page titles; keep labels short.
- Collapse long trails with an ellipsis rather than wrapping.
Don’t
- Don't make the current (last) item a link.
- Don't use breadcrumbs as primary navigation — they're a secondary wayfinding aid.
- Don't include every query-string step; show meaningful levels only.
Role
nav landmark with an ordered list; the current item uses aria-current="page" (handled).
Keyboard
Links are standard tab stops. (handled)
Screen reader
Announced as breadcrumb navigation; the current page is marked. Provide meaningful link text — you provide this.
Focus
Standard link focus. (handled)
Gotcha
The last crumb must be plain text (BreadcrumbPage), not a link — linking the current page confuses AT users.
import { Breadcrumb } from '@/components/ui/breadcrumb'
export default function Example() {
return (
<div className="p-6">
<Breadcrumb />
</div>
)
}
import * as React from 'react'
import { Slot } from '@radix-ui/react-slot'
import { ChevronRight, MoreHorizontal } from 'lucide-react'
import { cn } from '@/lib/utils'
function Breadcrumb({ ...props }: React.ComponentProps<'nav'>) {
return <nav aria-label='breadcrumb' data-slot='breadcrumb' {...props} />
}
function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>) {
return (
<ol
data-slot='breadcrumb-list'
className={cn(
'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
className
)}
{...props}
/>
)
}
function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>) {
return <li data-slot='breadcrumb-item' className={cn('inline-flex items-center gap-1.5', className)} {...props} />
}
function BreadcrumbLink({
asChild,
className,
...props
}: React.ComponentProps<'a'> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot : 'a'
return (
<Comp data-slot='breadcrumb-link' className={cn('hover:text-foreground transition-colors', className)} {...props} />
)
}
function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>) {
return (
<span
data-slot='breadcrumb-page'
role='link'
aria-disabled='true'
aria-current='page'
className={cn('text-foreground font-normal', className)}
{...p