Breadcrumb and Sidebar
Breadcrumb shows where a page sits in a hierarchy and links back up it. Sidebar lists the sections of an area. Both render native elements on the server.
import { Breadcrumb, Sidebar } from '@blocks/design-system'
// or the named parts
import { BreadcrumbItem, BreadcrumbRoot, SidebarItem, SidebarRoot, SidebarSection } from '@blocks/design-system'Neither is a client module, so the dot spelling (Breadcrumb.Item) and the named parts (BreadcrumbItem) both work in Server Components.
A detail page
A page usually has both: the sidebar for moving between sections, the breadcrumb for going up. Each is its own navigation landmark with its own name.
Mount Hood
Source · navigation/station-detail.tsx
import { Box, Breadcrumb, Grid, Heading, Sidebar } from '@blocks/design-system'
const regions = [
{ id: 'oregon', name: 'Oregon' },
{ id: 'washington', name: 'Washington' },
{ id: 'utah', name: 'Utah' },
]
export default function StationDetail() {
return (
<Grid columns="10rem minmax(0, 1fr)" gap="lg">
<Box as="nav" aria-label="Regions" border="default">
<Sidebar.Root>
<Sidebar.Section>
{regions.map((region) => (
<Sidebar.Item
key={region.id}
as="a"
href={`#region-${region.id}`}
active={region.id === 'oregon'}
aria-current={region.id === 'oregon' ? 'true' : undefined}
>
{region.name}
</Sidebar.Item>
))}
</Sidebar.Section>
<Sidebar.Divider />
<Sidebar.Section>
<Sidebar.Item as="a" href="#saved-stations">
Saved stations
</Sidebar.Item>
</Sidebar.Section>
</Sidebar.Root>
</Box>
<Box>
<Breadcrumb.Root>
<Breadcrumb.Item href="#stations">Stations</Breadcrumb.Item>
<Breadcrumb.Item href="#region-oregon">Oregon</Breadcrumb.Item>
<Breadcrumb.Item isCurrentPage>Mount Hood</Breadcrumb.Item>
</Breadcrumb.Root>
<Heading as="h3" marginTop="md">
Mount Hood
</Heading>
</Box>
</Grid>
)
}Breadcrumb
BreadcrumbRoot renders a <nav> labelled “Breadcrumb” (override with aria-label) around an ordered list, with a separator between items that assistive technology skips. Each BreadcrumbItem with an href is a native link; mark the last one isCurrentPage, which renders text with aria-current="page". separator takes any node.
Source · navigation/named-parts.tsx
import { BreadcrumbItem, BreadcrumbRoot } from '@blocks/design-system'
export default function NamedParts() {
return (
<BreadcrumbRoot aria-label="Board location" separator="›">
<BreadcrumbItem href="#boards">Boards</BreadcrumbItem>
<BreadcrumbItem href="#board-launch">Launch</BreadcrumbItem>
<BreadcrumbItem isCurrentPage>Write release notes</BreadcrumbItem>
</BreadcrumbRoot>
)
}Sidebar
SidebarRoot is a column of SidebarSections, optionally split by SidebarDivider. SidebarItem is a button unless you pass as; render as="a" (or a router link) for navigation and set aria-current on the current destination, or keep buttons for switching views in place and set aria-pressed. active gives an item the accent style. Wrap the sidebar in a <nav> with a name. For collapsible groups, use NavList.
Source · navigation/sidebar-buttons.tsx
'use client'
import { Box, Sidebar } from '@blocks/design-system'
import { useState } from 'react'
const views = ['Inbox', 'Assigned to me', 'Done']
// Buttons switch views in place; links (as above) go to other pages.
export default function SidebarButtons() {
const [view, setView] = useState(views[0])
return (
<Box as="nav" aria-label="Item views" maxWidth="sm" border="default">
<Sidebar.Root>
<Sidebar.Section>
{views.map((name) => (
<Sidebar.Item key={name} type="button" active={name === view} aria-pressed={name === view} onClick={() => setView(name)}>
{name}
</Sidebar.Item>
))}
</Sidebar.Section>
</Sidebar.Root>
</Box>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
separator | ReactNode | / | Shown between items. Defaults to `"/"`. |
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
href | string | — | Makes the item a link, unless it's the current page. |
isCurrentPage | boolean | false | Marks the item as the current page: plain text with `aria-current="page"`. |
onClick | (() => void) | — | Called when the item's link is clicked. |
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
SidebarRoot has no props of its own.
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
grow | boolean | false | Fills the remaining height, e.g. to push later sections to the bottom. |
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | false | Shows the item in the accent colors. |
as | ElementType | — | The element or component to render, e.g. `as={NextLink}`. |
Also accepts styling escape hatches, and the native attributes of the element it renders.
SidebarDivider has no props of its own.
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
Accessibility
- Name each navigation landmark differently, so a screen reader’s landmark list tells them apart.
activeis visual only. Pair it witharia-currentfor links oraria-pressedfor toggle buttons.- Keep the breadcrumb’s last item as text: it is where the reader already is.