Breadcrumbs
Breadcrumbs display a hierarchy of links to the current page or resource in an application.
Import
import { Breadcrumbs } from "@cfa/react-core";Live Editor
Examples
Default
A simple breadcrumb navigation with three pages.
Disabled Link
You can disable a link by setting the isDisabled prop. This is useful for indicating the current page.
Dynamic - Render Function
Out of the box, you can use the items prop and pass in an Iterable. This should include an id property in the object.
This allows you to use a render function to render the items. This handles some things behind the scenes like
setting a key.
Dynamic - Array Map
You can also use the standard .map() option, but keep in mind that you will have to manually add the key to the Breadcrumb.Item
Dynamic - Custom Navigation
You can also choose not to use the href props and utilize the onAction prop perform a custom action when an item is clicked.
The value that is passed into this function is a Key and will be the id of the item.
Props
Visit the Documentation Site for the full list of props.
| Name | Type | Default | Description |
|---|---|---|---|
| aria-describedby | string | - | Identifies the element (or elements) that describes the object. |
| aria-details | string | - | Identifies the element (or elements) that provide a detailed, extended description for the object. |
| aria-label | string | - | Defines a string value that labels the current element. |
| aria-labelledby | string | - | Identifies the element (or elements) that labels the current element. |
| children | ReactNode | ((item: T) => ReactNode) | - | The contents of the collection. |
| className | string | 'react-aria-Breadcrumbs' | The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. |
| dependencies | readonly any[] | - | Values that should invalidate the item cache when using dynamic collections. |
| dir | string | - | - |
| hidden | boolean | - | - |
| id | string | - | The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). |
| inert | boolean | - | - |
| items | Iterable<T> | - | Item objects in the collection. |
| lang | string | - | - |
| onAction | (key: Key) => void | - | Handler that is called when a breadcrumb is clicked. |
| onAnimationEnd | AnimationEventHandler<HTMLOListElement> | - | - |
| onAnimationEndCapture | AnimationEventHandler<HTMLOListElement> | - | - |
| onAnimationIteration | AnimationEventHandler<HTMLOListElement> | - | - |
| onAnimationIterationCapture | AnimationEventHandler<HTMLOListElement> | - | - |
| onAnimationStart | AnimationEventHandler<HTMLOListElement> | - | - |
| onAnimationStartCapture | AnimationEventHandler<HTMLOListElement> | - | - |
| onAuxClick | MouseEventHandler<HTMLOListElement> | - | - |
| onAuxClickCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onClick | MouseEventHandler<HTMLOListElement> | - | - |
| onClickCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onContextMenu | MouseEventHandler<HTMLOListElement> | - | - |
| onContextMenuCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onDoubleClick | MouseEventHandler<HTMLOListElement> | - | - |
| onDoubleClickCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onGotPointerCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onGotPointerCaptureCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onLostPointerCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onLostPointerCaptureCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onMouseDown | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseDownCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseEnter | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseLeave | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseMove | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseMoveCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseOut | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseOutCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseOver | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseOverCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseUp | MouseEventHandler<HTMLOListElement> | - | - |
| onMouseUpCapture | MouseEventHandler<HTMLOListElement> | - | - |
| onPointerCancel | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerCancelCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerDown | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerDownCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerEnter | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerLeave | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerMove | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerMoveCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerOut | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerOutCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerOver | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerOverCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerUp | PointerEventHandler<HTMLOListElement> | - | - |
| onPointerUpCapture | PointerEventHandler<HTMLOListElement> | - | - |
| onScroll | UIEventHandler<HTMLOListElement> | - | - |
| onScrollCapture | UIEventHandler<HTMLOListElement> | - | - |
| onTouchCancel | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchCancelCapture | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchEnd | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchEndCapture | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchMove | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchMoveCapture | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchStart | TouchEventHandler<HTMLOListElement> | - | - |
| onTouchStartCapture | TouchEventHandler<HTMLOListElement> | - | - |
| onTransitionCancel | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionCancelCapture | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionEnd | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionEndCapture | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionRun | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionRunCapture | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionStart | TransitionEventHandler<HTMLOListElement> | - | - |
| onTransitionStartCapture | TransitionEventHandler<HTMLOListElement> | - | - |
| onWheel | WheelEventHandler<HTMLOListElement> | - | - |
| onWheelCapture | WheelEventHandler<HTMLOListElement> | - | - |
| render | DOMRenderFunction<"ol", undefined> | - | Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components. Requirements: * You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`). * Only a single root DOM element can be rendered (no fragments). * You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate. |
| slot | string | - | A slot name for the component. Slots allow the component to receive props from a parent component. An explicit `null` value indicates that the local props completely override all props received from a parent. |
| style | CSSProperties | - | The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. |
| translate | "yes" | "no" | - | - |