Breadcrumb Item
Shoelace의 Breadcrumb Item 컴포넌트(sl-breadcrumb-item)는 breadcrumb 안에서 각각의 서로 다른 링크를 나타내는 데 사용돼요. sl-breadcrumb의 자식으로 사용되며, prefix·suffix·separator 슬롯을 제공해요.
출처: 문서
본문
Breadcrumb Item은 breadcrumb 안에서 서로 다른 링크를 나타내는 데 사용돼요.
<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>
);
추가적인 데모는 breadcrumb 예시에서 찾아볼 수 있어요.
Importing
autoloader나 전통적인 loader를 사용하고 있다면 이 부분은 무시해도 돼요. 그 외의 경우 아래 스니펫 중 하나를 골라 이 컴포넌트만 골라(cherry pick) 가져올 수 있답니다.
Script / Import / Bundler / React
CDN에서 script 태그로 이 컴포넌트를 가져오려면:
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.20.1/cdn/components/breadcrumb-item/breadcrumb-item.js"></script>
CDN에서 JavaScript import로 이 컴포넌트를 가져오려면:
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.20.1/cdn/components/breadcrumb-item/breadcrumb-item.js';
bundler를 사용해 이 컴포넌트를 가져오려면:
import '@shoelace-style/shoelace/dist/components/breadcrumb-item/breadcrumb-item.js';
이 컴포넌트를 React 컴포넌트로 가져오려면:
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. |
슬롯(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. |
속성과 프로퍼티(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. |
CSS 파트(parts) 커스터마이징에 대해 더 알아보기.
더 알아보기 (Learn more)
- Shoelace Breadcrumb 컴포넌트 — 이 아이템들이 들어가는 breadcrumb 컨테이너 문서
- Shoelace Icon 컴포넌트 — prefix·suffix에 자주 쓰는 아이콘 문서
- Shoelace 시작하기(getting started) — 컴포넌트 설치와 로딩 방법