- Components
Breadcrumb
The path to the current page: links up the tree, then the page itself.
npx shadcn add @klarhimmel/breadcrumbWhen to use
Use for
Showing where a page sits in a site more than two levels deep.
Not for
Steps in a process. Use a numbered list. Not a replacement for the main navigation.
Pairs with
Header, page titles.
Preview
breadcrumb.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Breadcrumb } from '@/components/klarhimmel/ui/breadcrumb';
export default function Example() {
return (
<Theme theme="brand">
<Breadcrumb items={[
{ label: 'Home', href: '/' },
{ label: 'Rooms', href: '/rooms' },
{ label: 'Garden room' },
]} />
</Theme>
);
}Install
Import
import { Breadcrumb } from '@/components/klarhimmel/ui/breadcrumb';- Lands in
- components/klarhimmel/ui/breadcrumb.tsx, plus cn() and the theme item if they are missing. Import theme.css after Tailwind.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Examples
Long
- Exempelhotellet
- Rooms and suites
- Seaside
- The corner suite with the long name and the balcony
import { Breadcrumb } from '@/components/klarhimmel/ui/breadcrumb'; export default function BreadcrumbLong() { return ( <div className="w-64 max-w-full rounded-kh-lg border border-dashed border-kh-line p-3"> <Breadcrumb items={[ { label: 'Exempelhotellet', href: '/' }, { label: 'Rooms and suites', href: '/rooms' }, { label: 'Seaside', href: '/rooms/seaside' }, { label: 'The corner suite with the long name and the balcony' }, ]} /> </div> ); }Two levels
import { Breadcrumb } from '@/components/klarhimmel/ui/breadcrumb'; export default function BreadcrumbTwoLevels() { return ( <div className="flex flex-col gap-4"> <Breadcrumb items={[{ label: 'Help', href: '/help' }, { label: 'Cancelling a booking' }]} /> <Breadcrumb label="You are here" items={[{ label: 'Home', href: '/' }, { label: 'Contact' }]} /> </div> ); }
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
items | { label: string; href?: string }[] | - | Required. In order from the top. The last item is the current page and is not a link. |
label | string | 'Breadcrumb' | Accessible name of the navigation landmark. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Moves through the links |
Enter | Follows a link |
The last item is the current page: aria-current="page", not a link. Long paths wrap; long labels truncate.
Accessibility