apps/docs/content/docs/en/react/components/(navigation)/breadcrumbs.mdx
import { Breadcrumbs } from '@heroui/react';
<ComponentPreview name="breadcrumbs-basic" />
Import the Breadcrumbs component and access all parts using dot notation.
import { Breadcrumbs } from '@heroui/react';
export default () => (
<Breadcrumbs>
<Breadcrumbs.Item href="#">Home</Breadcrumbs.Item>
<Breadcrumbs.Item href="#">Category</Breadcrumbs.Item>
<Breadcrumbs.Item>Current Page</Breadcrumbs.Item>
</Breadcrumbs>
)
<ComponentPreview name="breadcrumbs-level-2" />
<ComponentPreview name="breadcrumbs-level-3" />
<ComponentPreview name="breadcrumbs-custom-separator" />
<ComponentPreview name="breadcrumbs-disabled" />
<ComponentPreview name="breadcrumbs-custom-render-function" />
import { Breadcrumbs } from '@heroui/react';
function CustomBreadcrumbs() {
return (
<Breadcrumbs className="gap-2">
<Breadcrumbs.Item href="#" className="text-blue-600">
Home
</Breadcrumbs.Item>
<Breadcrumbs.Item>Current</Breadcrumbs.Item>
</Breadcrumbs>
);
}
To customize the Breadcrumbs component classes, you can use the @layer components directive.
@layer components {
.breadcrumbs {
@apply gap-4 text-lg;
}
.breadcrumbs__link {
@apply font-semibold;
}
.breadcrumbs__separator {
@apply text-blue-500;
}
}
HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Breadcrumbs component uses these CSS classes (View source styles):
.breadcrumbs - Base breadcrumbs container.breadcrumbs__item - Individual breadcrumb item wrapper.breadcrumbs__link - Breadcrumb link element.breadcrumbs__separator - Separator icon between items.breadcrumbs__link[data-current="true"] - Current page indicator (not a link)The component supports both CSS pseudo-classes and data attributes for flexibility:
[data-current="true"] on link (indicates current page)isDisabled prop disables all links| Prop | Type | Default | Description |
|---|---|---|---|
separator | ReactNode | chevron-right icon | Custom separator between breadcrumb items |
isDisabled | boolean | false | Whether all breadcrumb links are disabled |
className | string | - | Additional CSS classes |
children | ReactNode | - | The breadcrumb items |
render | DOMRenderFunction<keyof React.JSX.IntrinsicElements, undefined> | - | Overrides the default DOM element with a custom render function |
| Prop | Type | Default | Description |
|---|---|---|---|
href | string | - | The URL to link to (omit for current page) |
className | string | - | Additional CSS classes |
children | ReactNode | RenderFunction | - | Item content or render function |
render | DOMRenderFunction<keyof React.JSX.IntrinsicElements, BreadcrumbRenderProps> | - | Overrides the default DOM element with a custom render function |
Breadcrumbs uses React Aria Components' Breadcrumbs primitive, which provides:
aria-current="page"The last breadcrumb item (without href) automatically becomes the current page indicator.