KNOW IDEA UIv0.18.0GitHub

AppBar

画面上部のバー。タイトル(h1)、左側の要素、右側の操作、小さな補足を持つ。上部に固定することもできる。

tsx
import { AppBar, IconButton, Icon } from "knowidea-ui";

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

Demos

Basic

左にナビゲーションを開くボタン、右に操作を置く。補足は右寄せにする。

ホーム

更新

Show code
tsx
import { AppBar, IconButton, Icon } from "knowidea-ui";​function Basic() {  return (    <div style={{ width: "100%", border: "1px solid var(--color-line)", borderRadius: "var(--radius-3)", overflow: "hidden" }}>      <AppBar        title="ホーム"        leading={<IconButton label="ナビゲーションを開く" icon={<Icon name="menu" />} />}        meta={<><span>更新</span><time>10/13 09:28</time></>}        actions={<><IconButton label="更新" icon={<Icon name="refresh" />} /><IconButton label="設定" icon={<Icon name="settings" />} /></>}      />    </div>  );}

Long title

タイトルは 1 行に収め、はみ出す分は省略記号で省く。

とても長い画面のタイトルが入ったときは、1 行に収めて末尾を省略する

Show code
tsx
import { AppBar, IconButton, Icon } from "knowidea-ui";​function Plain() {  return (    <div style={{ width: "100%", border: "1px solid var(--color-line)", borderRadius: "var(--radius-3)", overflow: "hidden" }}>      <AppBar title="とても長い画面のタイトルが入ったときは、1 行に収めて末尾を省略する" actions={<IconButton label="検索" icon={<Icon name="search" />} />} />    </div>  );}

Plain HTML

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

ホーム

Show code
html
<header class="ki-appbar">  <h1 class="ki-appbar__title">ホーム</h1>  <div class="ki-appbar__actions"><button type="button" class="ki-button ki-icon-button" data-variant="quiet" aria-label="更新"><svg class="ki-icon" aria-hidden="true"><use href="#refresh"/></svg></button></div></header>

States

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

StateAppearance
Empty対象外。タイトルのないバーは作らない
Loading対象外。タイトルは先に決まっているため、ローディング状態を持たない。コンテンツの読み込みは本文側で示す
Error対象外。エラー状態を持たない。画面のエラーは本文側の Alert で示す
Disabled

サンプル

Focus

サンプル

API

NameTypeDefaultDescription
titleReactNode-タイトル(h1)。必須
leadingReactNode-タイトルの左に置く要素。ナビゲーションを開くボタンや戻るボタン
actionsReactNode-右側に置く操作。IconButton を並べる
metaReactNode-右寄せの小さな補足。2 行まで
headingLevel1 | 2 | 31タイトルの見出しレベル。ほかの見出しと並ぶ場所では 2 にする
position"static" | "sticky""static"sticky を指定すると上部に固定される

CSS

Classes and data attributes

NameDescription
.ki-appbar本体。data-position
.ki-appbar__leading、__brand、__title、__meta、__actions内部の要素

CSS variables

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

VariableUsage
--color-bg、--color-line背景と下線
--font-size-4タイトルのフォントサイズ
--size-hit最小の高さの基準

Accessibility

KNOW IDEA UIv0.18.0

GitHub

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

Code