Breadcrumb Item
<sl-breadcrumb-item> | SlBreadcrumbItem
Breadcrumb Items are used inside breadcrumbs to represent different links.
<sl-breadcrumb> <sl-breadcrumb-item> <sl-icon slot="prefix" name="house"></sl-icon> Home </sl-breadcrumb-item> <sl-breadcrumb-item>Clothing</sl-breadcrumb-item> <sl-breadcrumb-item>Shirts</sl-breadcrumb-item> </sl-breadcrumb>
import SlBreadcrumb from '@shoelace-style/shoelace/dist/react/breadcrumb'; import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item'; import SlIcon from '@shoelace-style/shoelace/dist/react/icon'; const App = () => ( <SlBreadcrumb> <SlBreadcrumbItem> <SlIcon slot="prefix" name="house"></SlIcon> Home </SlBreadcrumbItem> <SlBreadcrumbItem>Clothing</SlBreadcrumbItem> <SlBreadcrumbItem>Shirts</SlBreadcrumbItem> </SlBreadcrumb> );
Additional demonstrations can be found in the breadcrumb examples.
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.19.1/cdn/components/breadcrumb-item/breadcrumb-item.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.19.1/cdn/components/breadcrumb-item/breadcrumb-item.js';
To import this component using a bundler:
import '@shoelace-style/shoelace/dist/components/breadcrumb-item/breadcrumb-item.js';
To import this component as a React component:
import SlBreadcrumbItem from '@shoelace-style/shoelace/dist/react/breadcrumb-item';
Slots
Name | Description |
---|---|
(default) | The breadcrumb item’s label. |
prefix
|
An optional prefix, usually an icon or icon button. |
suffix
|
An optional suffix, usually an icon or icon button. |
separator
|
The separator to use for the breadcrumb item. This will only change the separator for this item. If
you want to change it for all items in the group, set the separator on
<sl-breadcrumb> instead.
|
Learn more about using slots.
Properties
Name | Description | Reflects | Type | Default |
---|---|---|---|---|
href
|
Optional URL to direct the user to when the breadcrumb item is activated. When set, a link will be rendered internally. When unset, a button will be rendered instead. |
string | undefined
|
- | |
target
|
Tells the browser where to open the link. Only used when href is set. |
'_blank' | '_parent' | '_self' | '_top' | undefined
|
- | |
rel
|
The rel attribute to use on the link. Only used when href is set. |
string
|
'noreferrer noopener'
|
|
updateComplete |
A read-only promise that resolves when the component has finished updating. |
Learn more about attributes and properties.
Parts
Name | Description |
---|---|
base |
The component’s base wrapper. |
label |
The breadcrumb item’s label. |
prefix |
The container that wraps the prefix. |
suffix |
The container that wraps the suffix. |
separator |
The container that wraps the separator. |
Learn more about customizing CSS parts.