Breadcrumbs

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 is always the active item.
  • The last breadcrumb item should always be annotated with the aria-current="page" attribute.

Examples

Emphasis (color)

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

<Breadcrumbs.Root aria-label="Breadcrumbs">
  <Breadcrumbs.List>
    <Breadcrumbs.Item icon={Home}>Home</Breadcrumbs.Item>
    <Breadcrumbs.Item>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}>Home</Breadcrumbs.Item>
    <Breadcrumbs.Item>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}>Home</Breadcrumbs.Item>
    <Breadcrumbs.Item>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}>Home</Breadcrumbs.Item>
    <Breadcrumbs.Item>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}>Home</Breadcrumbs.Item>
    <Breadcrumbs.Item>Components</Breadcrumbs.Item>
    <Breadcrumbs.Item aria-current="page">Breadcrumbs</Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

Use the render prop on the <Breadcrumbs.Item> component to change the root element to your framework's link component. 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" />}>
      Components
    </Breadcrumbs.Item>
    <Breadcrumbs.Item
      aria-current="page"
      render={<Link to="/components/breadcrumbs" />}
    >
      Breadcrumbs
    </Breadcrumbs.Item>
  </Breadcrumbs.List>
</Breadcrumbs.Root>

Disabled Item

Use the disabled prop to disable a breadcrumb item.

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

Shortcuts

Item

The Breadcrumbs.Item component is a convenient shorthand for rendering each part of the breadcrumb item. It's equivalent to the following:

<Breadcrumbs.ItemRoot {...props}>
  <Breadcrumbs.ItemTrigger
    aria-current={ariaCurrent}
    render={render}
    {...itemTriggerProps}
  >
    {icon ? <Breadcrumbs.ItemIcon icon={icon} {...itemIconProps} /> : null}
    {children}
  </Breadcrumbs.ItemTrigger>
  <Breadcrumbs.ItemSeparator icon={separator} {...separatorProps} />
</Breadcrumbs.ItemRoot>

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.
Allows you to replace the component's HTML element with a different tag, or compose it with another component. 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
Allows you to replace the component's HTML element with a different tag, or compose it with another component. 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