Breadcrumbs
現在のページまでの階層を、上位から順に示す。最後は現在のページで、リンクにしない。
tsx
import { Breadcrumbs } from "knowidea-ui";カテゴリ: Navigation。同じカテゴリ: Link、Tabs、Menu、Pagination、AppBar、Drawer、BottomNavigation
Demos
Basic
Show code
tsx
import { Breadcrumbs } from "knowidea-ui";function Basic() { return ( <Breadcrumbs items={[{ label: "ホーム", href: "#home" }, { label: "設定", href: "#settings" }, { label: "通知" }]} /> );}Long path
幅が狭いときは折り返す。
Show code
tsx
import { Breadcrumbs } from "knowidea-ui";function Long() { return ( <Breadcrumbs items={[{ label: "ホーム", href: "#a" }, { label: "プロジェクト", href: "#b" }, { label: "サンプルの項目", href: "#c" }, { label: "履歴", href: "#d" }, { label: "2026 年 10 月の更新履歴" }]} /> );}Plain HTML
React を使わないページでは、knowidea-css の CSS を読み込み、クラスを指定する。
Show code
html
<nav class="ki-breadcrumbs" aria-label="現在地"> <ol> <li><a href="#">ホーム</a></li> <li><a href="#">設定</a></li> <li><span aria-current="page">通知</span></li> </ol></nav>States
すべてのコンポーネントが、Empty、Loading、Error、Disabled、Focus の 5 つの状態を備える。Hover と Active は、確認用に固定して表示している。そのコンポーネントにあてはまらない状態は「対象外」とし、理由を添える。
| State | Appearance |
|---|---|
| Empty | 対象外。階層が 1 つだけのときは表示しない |
| Loading | 対象外。階層は URL から決まるため、ローディング状態を持たない |
| Error | 対象外。エラー状態を持たない |
| Disabled | 対象外。途中の階層を無効にはしない。移動できない階層は href を外し、テキストだけで示す |
| Focus | リンクにフォーカスが移ると、2px のリングが表示される |
API
| Name | Type | Default | Description |
|---|---|---|---|
items | { label, href? }[] | - | 上位の階層から順に並べる。最後が現在のページ |
label | string | "現在地" | nav の名前 |
CSS
Classes and data attributes
| Name | Description |
|---|---|
.ki-breadcrumbs | nav。内部は ol |
[aria-current="page"] | 現在のページ(リンクにしない) |
CSS variables
コンポーネントが参照するのは、役割を表す名前の変数だけで、素の値は参照しない。オーバーライドの方法は Overriding を参照。
| Variable | Usage |
|---|---|
| --color-text-muted、--color-text | リンクと現在のページの色 |
| --size-hit | リンクの高さ |
| --color-focus | フォーカスリング |
Accessibility
- <nav aria-label="現在地"> と <ol> を使う。現在のページには aria-current="page" を付ける
- 区切りは CSS による装飾で、読み上げない