Breadcrumbs
Use as a secondary navigation pattern to help convey hierarchy and enable navigation.
Basic Usage
Any Paragon component or export may be added to the code example.
Basic Usage (Mobile View)
Any Paragon component or export may be added to the code example.
Basic Usage (Inverse Palette)
Any Paragon component or export may be added to the code example.
With custom link element
By default Breadcrumb
uses a
tag to render breadcrumbs, which may not always suit your needs.
This behaviour can be customized with linkAs
prop, the example below uses Gatsby's Link
component, but it would also work with react-router's Link
component as well because they share required parts of the component API.
Note that links
list contains objects with different keys compared to the example above, specifically href
key is replaced with to
, that's because Gatsby's Link
expects its destination to be set through to
prop (same as react-router's Link
), internally Breadcrumb
passes down these objects (except label
attribute) as props to the linkAs
element.
Any Paragon component or export may be added to the code example.
With active label
Any Paragon component or export may be added to the code example.
With custom spacer
Any Paragon component or export may be added to the code example.
Theme Variables (SCSS)#
$breadcrumb-font-size: null !default;$breadcrumb-padding-y: .75rem !default;$breadcrumb-padding-x: 1rem !default;$breadcrumb-item-padding: .5rem !default;$breadcrumb-margin-bottom: 1rem !default;$breadcrumb-margin-left: .5rem !default;$breadcrumb-border-focus-axis-x: .25rem !default;$breadcrumb-border-focus-axis-y: .5rem !default;$breadcrumb-border-focus-width: .0625rem !default;$breadcrumb-bg: $gray-200 !default;$breadcrumb-divider-color: $gray-600 !default;$breadcrumb-active-color: $gray-500 !default;$breadcrumb-inverse-active: $light-500 !default;$breadcrumb-inverse-spacer: $light-700 !default;$breadcrumb-color: $primary-500 !default;$breadcrumb-inverse-color: $white !default;$breadcrumb-divider: "/" !default;$breadcrumb-border-radius: $border-radius !default;$breadcrumb-focus-border-radius: .125rem !default;
Props API#
- links
shape
{label:}string
,[]
RequiredAn array of objects describing links to be rendered. The contents of an object depend on the value of
linkAs
prop as these objects will get passed down as props to the underlying component defined bylinkAs
prop. - activeLabel
string
allows to add a label that is not a link to the end of the breadcrumb.
- ariaLabel
string
Default'breadcrumb'label of the element
- spacer
element
allows to add a custom element between the breadcrumb items. Defaults to
>
rendered using theIcon
component. - clickHandler
func
allows to add a custom function to be called
onClick
of a breadcrumb link. The use case for this is for adding custom analytics to the component. - variant
enum
'light' | 'dark'Default'light'The
Breadcrumbs
style variant to use. - isMobile
bool
DefaultfalseThe
Breadcrumbs
mobile variant view. - linkAs
elementType
Default'a'Specifies the base element to use when rendering links, you should generally use either plain 'a' or react-router's Link.
Usage Insights#
Breadcrumb
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.46.3 | 2 | |
frontend-app-course-authoring | 20.46.2 | 1 | |
frontend-app-learner-portal-enterprise | 20.45.4 | 3 | |
frontend-app-library-authoring | 21.5.6 | 2 | |
prospectus | 20.46.2 | 3 |