KNOW IDEA UIv0.18.0GitHub

BottomNavigation

狭い幅での主要な移動手段。アイコンと短い文字を 3〜5 個並べる。

tsx
import { BottomNavigation } from "knowidea-ui";

カテゴリ: Navigation。同じカテゴリ: Link、Tabs、Menu、Breadcrumbs、Pagination、AppBar、Drawer

Demos

Basic

件数のバッジは、項目の右上に表示される。

Show code
tsx
import { BottomNavigation, type NavItem } from "knowidea-ui";​const items: NavItem[] = [  { id: "home", label: "ホーム", icon: "home", href: "#home" },  { id: "list", label: "一覧", icon: "list", href: "#list", count: 3 },  { id: "calendar", label: "予定", icon: "calendar", href: "#calendar" },  { id: "settings", label: "設定", icon: "settings", href: "#settings" },];​function Basic() {  return (    <div style={{ width: "min(100%, 390px)", border: "1px solid var(--color-line)", borderRadius: "var(--radius-3)", overflow: "hidden" }}>      <BottomNavigation items={items} current="home" />    </div>  );}

Plain HTML

React を使わないページでは、knowidea-css の CSS を読み込み、クラスを指定する。

Show code
html
<nav class="ki-bottomnav" aria-label="画面の切り替え">  <ul class="ki-bottomnav__list">    <li><a class="ki-bottomnav__item" href="#" aria-current="page"><svg class="ki-icon" aria-hidden="true"><use href="#home"/></svg>ホーム</a></li>    <li><a class="ki-bottomnav__item" href="#"><svg class="ki-icon" aria-hidden="true"><use href="#list"/></svg>一覧</a></li>  </ul></nav>

States

すべてのコンポーネントが、Empty、Loading、Error、Disabled、Focus の 5 つの状態を備える。Hover と Active は、確認用に固定して表示している。そのコンポーネントにあてはまらない状態は「対象外」とし、理由を添える。

StateAppearance
Empty対象外。項目のないナビゲーションは作らない
Loading対象外。項目は先に決まっているため、ローディング状態を持たない
Error対象外。エラー状態を持たない
Disabled
Focus

項目に Tab で移ると、2px のリングが表示される

API

NameTypeDefaultDescription
itemsNavItem[]-3〜5 個。{ id, label, icon?, href, count?, disabled? }
currentstring-現在のページの id
labelstring"画面の切り替え"nav の名前
position"static" | "sticky""static"sticky を指定すると下部に固定される

CSS

Classes and data attributes

NameDescription
.ki-bottomnavnav。data-position
.ki-bottomnav__list、__itemリストと項目(aria-current="page" が現在のページ)

CSS variables

コンポーネントが参照するのは、役割を表す名前の変数だけで、素の値は参照しない。オーバーライドの方法は Overriding を参照。

VariableUsage
--color-surface、--color-line背景と上の線
--color-primary現在のページ
--size-hit項目の高さの基準(52px)

Accessibility

KNOW IDEA UIv0.18.0

GitHub

ページと見出しを探す。/ か Ctrl K でどのページからも開く。

Code