Skip to main content

Breadcrumbs

Where the page sits in a hierarchy, each level a link back up. The last item is the current page. Use it on tablets and the web, in file browsers, settings and admin screens; on a phone, a Header with a back button does the job.

import { Breadcrumbs } from 'patine-ui';
Loading…
<Box padding="lg" border radius="lg" gap="sm" style={{ maxWidth: 520 }}>
  <Breadcrumbs
    maxItems={4}
    items={path.map((label, i) => ({
      label,
      icon: i === 0 ? <Icon name="home" size="sm" /> : undefined,
      onPress: () => setPath(path.slice(0, i + 1)),
    }))}
  />
  <Heading level={3}>{path[path.length - 1]}</Heading>
  <Text color="textSecondary">Press a level to go back up to it.</Text>
</Box>

Try the props​

Props
maxItems
design
<Breadcrumbs items={path} />

Example: a file browser​

A shared drive: opening a folder adds it to the trail, and pressing any level goes back up to it. Long paths fold their middle into a menu.

Loading…
<Box border radius="lg" padding="md" gap="sm" style={{ width: '100%', maxWidth: 480 }}>
  <Breadcrumbs
    maxItems={4}
    items={path.map((label, i) => ({
      label,
      icon: i === 0 ? <Icon name="home" size="sm" /> : undefined,
      onPress: i < path.length - 1 ? () => setPath(path.slice(0, i + 1)) : undefined,
    }))}
  />
  <List>
    {folders.map((name) => (
      <ListItem key={name} leading={<Icon name="folder" />} title={name} description={`${DRIVE[name].length} folders`} onPress={() => setPath([...path, name])} />
    ))}
  </List>
  {folders.length ? null : <Text color="textSecondary">This folder holds files only.</Text>}
</Box>

Long paths​

Past maxItems, the middle levels fold into …, keeping the first and the last ones. Pressing … unfolds the whole path.

Separator​

Each design has its own: a slash on the web and in brand, as shadcn draws it, and a chevron on iOS and Material. separator takes any string or node.

Loading…
<VStack gap="md">
  <Breadcrumbs items={items} separator="/" />
  <Breadcrumbs items={items} separator="›" />
  <Breadcrumbs items={items} separator="→" />
</VStack>

Designs​

  • brand and web: gray links and slashes, the current page in the text color, as shadcn's Breadcrumb.
  • iOS and Material 3: links in the primary color with a chevron, the current page bolder.

Accessibility​

  • A navigation landmark named 'Breadcrumb' (accessibilityLabel). Each level is a link; the current page is plain text marked aria-current="page".
  • Separators are hidden from screen readers. The … is a link named 'Show path' (expandLabel).
  • Links reach a 44pt touch height on phones and show a focus ring on the web.

Props​

Also takes View props.

PropTypeDefaultDescription
items{ label, onPress?, icon? }[]—The path from the top to the current page.
separatorReactNodethe design'sBetween items.
maxItemsnumberno limitFolds the middle into … past this many.
accessibilityLabelstring'Breadcrumb'Names the trail.
expandLabelstring'Show path'The … link's name.
styles{ item?, current?, separator? }—Slot styles.
theme, designAs every component.