Oddmash UI
すべてのコンポーネント

ドキュメントナビゲーション

ドキュメントリンクをグループ化し、現在の移動先を示します。

使い方

グループ化された移動先と任意のモバイルラベルを渡します。ルーティングは利用側が管理します。

アクセシビリティ

ランドマークに名前を付け、ネイティブリンクと現在のページ、モバイルの展開状態を維持します。

プロパティ型既定値
groupsreadonly DocsNavigationGroup[]Required
currentIdstringNone
mobileLabelstringNone
defaultMobileOpenbooleanfalse
onNavigatefunctionNative navigation
const Example = () => {
  const [current, setCurrent] = useState('guide');
  return (
    <DocsNavigation aria-label="Documentation navigation example"
      mobileLabel="Browse documentation" currentId={current}
      groups={[{ id: 'start', label: 'Start here', items: [
        { id: 'guide', label: 'Usage guide', href: '/guide' },
        { id: 'api', label: 'API reference', href: '/api' }
      ] }]}
      onNavigate={(item, event) => {
        event.preventDefault();
        setCurrent(item.id);
      }}
    />
  );
};

インタラクティブなドキュメント