Skip to content

Breadcrumbs

Compound breadcrumb navigation with auto-separator and composable parts for links, collapsed items, and custom separators.

Preview

Installation

$pnpm exec dgadd add ui/breadcrumbs
[Installs to]src/components/ui/breadcrumbs[Item]ui/breadcrumbs

dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.

UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.

Usage

tsx
import { Breadcrumbs } from "@/components/ui/breadcrumbs";export default function BreadcrumbsDefault() {  return (    <Breadcrumbs>      <Breadcrumbs.Item>        <Breadcrumbs.Link href="/ui/docs">Docs</Breadcrumbs.Link>      </Breadcrumbs.Item>      <Breadcrumbs.Item>        <Breadcrumbs.Link href="/ui/docs/components">Components</Breadcrumbs.Link>      </Breadcrumbs.Item>      <Breadcrumbs.Item>Breadcrumbs</Breadcrumbs.Item>    </Breadcrumbs>  );}

Examples

Custom Separator

Preview

Custom Link

Preview

Ellipsis

Preview

Constrained Width

Preview

API Reference

NameTypeDefaultDescription
separatorReactNode"/"Separator rendered between items. Pass null to omit.
childrenReactNodeBreadcrumbs.Item children. The last item is auto-marked current when no item already sets current.
NameTypeDefaultDescription
currentbooleanfalseMarks the item as the current page. Auto-applied to the last item when no item explicitly sets it. Adds aria-current="page" and bold styling.
childrenReactNodeItem content, typically a Breadcrumbs.Link or plain text.
NameTypeDefaultDescription
hrefstringAnchor href. Omit when using the render-prop form with a framework Link.
childrenrequiredReactNode | (props: BreadcrumbsLinkRenderProps) => ReactNodeLink label, or a render function that receives ref, className, aria-current, and remaining anchor props.
NameTypeDefaultDescription
labelstring"More"Screen-reader text announcing collapsed breadcrumb levels.
childrenReactNode"..."Ellipsis content (defaults to three dots).

Accessibility

Notes

Current Page

Use the current prop on any Breadcrumbs.Item to mark it as the current page (sets aria-current='page' and bold styling).

Auto-Separator

Separators are inserted automatically between items. Pass separator={<ChevronRight />} to customize, or separator={null} to disable.

Router Integration

Use the render-prop on Breadcrumbs.Link to integrate framework link components (Next.js Link, React Router NavLink). Pass a function as children to receive computed props (ref, className, etc.) and render your custom element.

Source

Install via CLI: pnpm exec dgadd add ui/breadcrumbs.

Highlighted source loads after this disclosure opens. Browse the source repository.