Basic usage
import {Breadcrumb} from '@pleo-io/telescope'
export const SsoBreadcrumb = () => (
<Breadcrumb aria-label="Breadcrumb">
<Breadcrumb.Item href="/settings">Settings</Breadcrumb.Item>
<Breadcrumb.Item href="/settings/people-access">People & access</Breadcrumb.Item>
<Breadcrumb.Item>Single sign-on</Breadcrumb.Item>
</Breadcrumb>
)The last Breadcrumb.Item is the current page: it renders as text with aria-current="page", so it
needs no href. Pass the items directly as children; wrapping them in your own components or
fragments hides them from Breadcrumb.
See the API reference for all props and Guidelines for when and why to use the various options.
Examples
React Router
Use as and to to render the items as react-router links:
import {Link} from 'react-router'
import {Breadcrumb} from '@pleo-io/telescope'
export const SsoBreadcrumb = () => (
<Breadcrumb aria-label="Breadcrumb">
<Breadcrumb.Item as={Link} to="/settings">
Settings
</Breadcrumb.Item>
<Breadcrumb.Item>People & access</Breadcrumb.Item>
</Breadcrumb>
)The pages in the "…" menu use the same as and to, so collapsed items navigate the same way.
Collapsing and truncating
Collapsing is automatic. Four levels collapse when they do not fit, and trails with more than four levels are always collapsed, keeping the first item and the last two. Labels are truncated with an ellipsis and shown in a tooltip when they are cut off. Don't wrap the breadcrumb in a container that allows it to overflow; give it the width of the page content.
Accessibility
aria-labelis required: it names the navigation landmark. Pass a translated string.- The label of the "…" button comes from the
Breadcrumb.MoreButtontranslation of theTelescopeProvider. Provide it in every language you support.
API reference
Shows where the user is in the page hierarchy and lets them go back up. The trail always stays on one row: when it does not fit, the items between the first one and the last two collapse into a menu, and then the labels are truncated.
| Prop | Type | Default |
|---|---|---|
aria-label (required)Accessible name of the navigation landmark. Describe what the trail is, for example "Breadcrumb", and translate it. | string | |
children (required)The trail, as | enumnull, string, number, bigint, false, true, ReactElement<unknown, string | JSXElementConstructor<any>>, Iterable<ReactNode>, ReactPortal, Promise<AwaitedReactNode> |