Breadcrumbs

Breadcrumbs help users understand their current location within a website or application hierarchy and provide a quick way to navigate back to parent pages.

import {Breadcrumbs} from "@qualcomm-ui/react/breadcrumbs"

Overview

  • The root component should be labeled with aria-label="Breadcrumbs" to indicate that it's a breadcrumb navigation.
  • The first breadcrumb item is always the root item, and is typically reserved for the home page or base route of your application.
  • The last breadcrumb item represents the current page. Mark it with aria-current="page".
  • By default, Breadcrumbs.Item renders a <span> (non-link content). Pass the render prop when an item should navigate.

Examples

Breadcrumbs.Item renders a non-link <span> by default, which is appropriate for the current page item. Use the render prop to make an item navigable. In most cases this will be your router's link component. Fall back to a plain <a href> if you don't use a router. The following example uses React Router:

<Breadcrumbs.Root aria-label="Breadcrumbs">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home} render={<Link to="/" />}>
      Home
    </Breadcrumbs.Item>
    <Breadcrumbs.Item render={<Link to="/components/overview" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item
      aria-current="page"
      render={<Link to="/components/breadcrumbs" />}
    >
      Breadcrumbs
    </Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

Emphasis (color)

Use the emphasis prop to change the color of the breadcrumbs.

<Breadcrumbs.Root aria-label="Breadcrumbs">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home} render={<Link to="/" />}>
      Home
    </Breadcrumbs.Item>
    <Breadcrumbs.Item render={<Link to="/components/overview" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

<Breadcrumbs.Root aria-label="Breadcrumbs" emphasis="neutral">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home} render={<Link to="/" />}>
      Home
    </Breadcrumbs.Item>
    <Breadcrumbs.Item render={<Link to="/components/overview" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

Sizes

Three sizes are available via the size prop: sm, md, and lg. The default size is md.

<Breadcrumbs.Root aria-label="Breadcrumbs" size="sm">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home} render={<Link to="/" />}>
      Home
    </Breadcrumbs.Item>
    <Breadcrumbs.Item render={<Link to="/components/overview" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

<Breadcrumbs.Root aria-label="Breadcrumbs" size="md">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home} render={<Link to="/" />}>
      Home
    </Breadcrumbs.Item>
    <Breadcrumbs.Item render={<Link to="/components/overview" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

<Breadcrumbs.Root aria-label="Breadcrumbs" size="lg">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home} render={<Link to="/" />}>
      Home
    </Breadcrumbs.Item>
    <Breadcrumbs.Item render={<Link to="/components/overview" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

Disabled Item

Use the disabled prop to disable a breadcrumb item.

<Breadcrumbs.Item disabled>Components</Breadcrumbs.Item>

Overflow

Use the Breadcrumbs.OverflowItem component to collapse intermediate breadcrumb items into a menu. The overflow trigger displays an ellipsis by default. Use the icon prop to add an icon, or provide your own trigger via Breadcrumbs.OverflowTrigger.

<Breadcrumbs.OverflowItem>
  <Menu.Item render={<Link to="/settings" />} value="settings">
    Settings
  </Menu.Item>
  <Menu.Item render={<Link to="/settings/account" />} value="account">
    Account
  </Menu.Item>
</Breadcrumbs.OverflowItem>

Tooltip

To provide additional context on hover, make Breadcrumbs.ItemTrigger a Tooltip trigger using the composite API.

<Breadcrumbs.Root aria-label="Breadcrumbs">
  <Breadcrumbs.List>
    <Breadcrumbs.ItemRoot>
      <Tooltip
        trigger={
          <Breadcrumbs.ItemTrigger render={<Link to="/" />}>
            <Breadcrumbs.ItemIcon icon={Home} />
            Home
          </Breadcrumbs.ItemTrigger>
        }
      >
        Navigate to home page
      </Tooltip>
      <Breadcrumbs.ItemSeparator />
    </Breadcrumbs.ItemRoot>

    <Breadcrumbs.ItemRoot>
      <Tooltip
        trigger={
          <Breadcrumbs.ItemTrigger
            render={<Link to="/components/overview" />}
          >
            Components
          </Breadcrumbs.ItemTrigger>
        }
      >
        Browse all components
      </Tooltip>
      <Breadcrumbs.ItemSeparator />
    </Breadcrumbs.ItemRoot>

    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

Shortcuts

Item

The Breadcrumbs.Item component is a convenient shorthand for rendering each part of the breadcrumb item. The trigger renders a <span> by default; pass the render prop to swap it for an anchor or a router link component.

<Breadcrumbs.ItemRoot>
  <Breadcrumbs.ItemTrigger aria-current={ariaCurrent} render={render}>
    <Breadcrumbs.ItemIcon icon={icon} />
    {children}
  </Breadcrumbs.ItemTrigger>
  <Breadcrumbs.ItemSeparator />
</Breadcrumbs.ItemRoot>

OverflowItem

The Breadcrumbs.OverflowItem component is a convenient shorthand that composes a menu trigger with the overflow ellipsis. It's equivalent to the following:

<Breadcrumbs.OverflowItemRoot {...props}>
  <Menu.Root size={menuSize}>
    <Menu.Trigger>
      <Breadcrumbs.OverflowTrigger
        aria-label={ariaLabel}
        icon={icon}
        {...overflowTriggerProps}
      />
    </Menu.Trigger>
    <Portal>
      <Menu.Positioner>
        <Menu.Content>{children}</Menu.Content>
      </Menu.Positioner>
    </Portal>
  </Menu.Root>
  <Breadcrumbs.ItemSeparator icon={separator} {...separatorProps} />
</Breadcrumbs.OverflowItemRoot>

API

The root element of the breadcrumbs component. Renders a <nav> element by default.
PropTypeDefault
Governs the color of the breadcrumb item text and icon.
| 'primary'
| 'neutral'
'primary'
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
Governs the size of the breadcrumb item text and icon.
| 'sm'
| 'md'
| 'lg'
'md'
Type
| 'primary'
| 'neutral'
Description
Governs the color of the breadcrumb item text and icon.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
Type
| 'sm'
| 'md'
| 'lg'
Description
Governs the size of the breadcrumb item text and icon.
The list of breadcrumbs. Renders an <ol> element by default.
PropType
React children prop.
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
Description
React children prop.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
PropTypeDefault
The aria-current attribute, should be set to page when the item is the current page.
'page'
React children prop.
Controls the component's interactivity. If true, the component becomes unresponsive to input and is visually dimmed to indicate its disabled state.
boolean
The icon to display next to the item trigger.
| LucideIcon
| ReactNode
Props applied to the item icon element.
Props applied to the item trigger element.
Replaces the trigger element with an anchor, a router Link, or any other component. Omitting it renders a plain <span> (e.g. the current page). Learn more
| Element
| ((
props: object,
) => Element)
The separator element to render between items.
| LucideIcon
| ReactNode
ChevronRight
Props applied to the separator element.
Type
'page'
Description
The aria-current attribute, should be set to page when the item is the current page.
Description
React children prop.
Type
boolean
Description
Controls the component's interactivity. If true, the component becomes unresponsive to input and is visually dimmed to indicate its disabled state.
Type
| LucideIcon
| ReactNode
Description
The icon to display next to the item trigger.
Description
Props applied to the item icon element.
Description
Props applied to the item trigger element.
Type
| Element
| ((
props: object,
) => Element)
Description
Replaces the trigger element with an anchor, a router Link, or any other component. Omitting it renders a plain <span> (e.g. the current page). Learn more
Type
| LucideIcon
| ReactNode
Description
The separator element to render between items.
Description
Props applied to the separator element.
PropType
The icon or element to render before the item.
| LucideIcon
| ReactNode
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
Type
| LucideIcon
| ReactNode
Description
The icon or element to render before the item.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
PropType
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
PropTypeDefault
The separator element to render between items.
| LucideIcon
| ReactNode
ChevronRight
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
Type
| LucideIcon
| ReactNode
Description
The separator element to render between items.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
PropTypeDefault
Accessible label for the overflow trigger button.
string
"Show more"
Menu items to display in the overflow dropdown.
Controls the component's interactivity. If true, the component becomes unresponsive to input and is visually dimmed to indicate its disabled state.
boolean
The icon to display next to the ellipsis.
| LucideIcon
| ReactNode
Props applied to the overflow trigger element.
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
The separator element to render after the overflow item.
| LucideIcon
| ReactNode
ChevronRight
Props applied to the separator element.
Type
string
Description
Accessible label for the overflow trigger button.
Description
Menu items to display in the overflow dropdown.
Type
boolean
Description
Controls the component's interactivity. If true, the component becomes unresponsive to input and is visually dimmed to indicate its disabled state.
Type
| LucideIcon
| ReactNode
Description
The icon to display next to the ellipsis.
Description
Props applied to the overflow trigger element.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
Type
| LucideIcon
| ReactNode
Description
The separator element to render after the overflow item.
Description
Props applied to the separator element.
PropTypeDefault
React children prop.
"…"
The icon to display next to the ellipsis.
| LucideIcon
| ReactNode
Props applied to the item icon element.
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
Description
React children prop.
Type
| LucideIcon
| ReactNode
Description
The icon to display next to the ellipsis.
Description
Props applied to the item icon element.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
Last updated on by Ryan Bower