Tab
ユーザーがアプリケーションの異なるビューや機能の側面を切り替えられるようにするナビゲーションコンポーネント。
いつ使うか
- タブを使用すると、異なるビュー間の切り替えが簡単になります。
- ページの機能的な側面には通常(ライン)タブを使用します。
- 特定のコンテナやカード内のビューを管理するには、囲まれた(Enclosed)タブを使用します。
- セカンダリまたはセグメント化されたコントロールには、ボタン/ピルタブを使用します。
astro
<Tabs orientation='horizontal'>
<Tab id='tab-line-1' label='Overview' active={true} variant='line' />
<Tab id='tab-line-2' label='Integrations' variant='line' />
<Tab id='tab-line-3' label='Settings' variant='line' />
</Tabs> astro
<Tabs>
<Tab label='Music' active={true} variant='button' />
<Tab label='Podcasts' variant='button' />
<Tab label='Live' variant='button' />
</Tabs>
<Tabs>
<Tab label='All' active={true} variant='pill' />
<Tab label='Unread' variant='pill' />
<Tab label='Mentions' variant='pill' />
</Tabs> astro
<Tabs orientation='horizontal'>
<Tab label='Account' active={true} variant='enclosed' />
<Tab label='Password' variant='enclosed' />
<Tab label='Team' variant='enclosed' />
</Tabs> astro
<Tabs orientation='horizontal'>
<Tab label='Messages' iconLeft='Mail' active={true} />
<Tab label='Alerts' iconRight='Bell' />
</Tabs>
<Tabs>
<Tab label='Home' icon='House' variant='icon' active={true} />
<Tab label='Search' icon='Search' variant='icon' />
<Tab label='Profile' icon='User' variant='icon' />
</Tabs> astro
<Tabs orientation='horizontal'>
<Tab label='main.js' active={true} variant='enclosed' closable />
<Tab label='style.css' variant='enclosed' closable />
<Tab label='index.html' variant='enclosed' closable />
</Tabs> This is content for Tab One.
astro
<Tabs orientation="horizontal">
<Tab label="Tab One" active={true} controls="panel1" />
<Tab label="Tab Two" controls="panel2" />
</Tabs>
<div id="panel1">This is content for Tab One.</div>
<div id="panel2" hidden style="display: none;">This is content for Tab Two.</div> astro
<Tabs orientation="horizontal">
<Tab label="Account" active={true} />
<Tab label="Password" />
<Tab label="Team" />
</Tabs> astro
<Tabs orientation='vertical' class='w-48'>
<Tab label='General' active={true} class='w-full justify-start border-l-2 border-b-0 -ml-0.5' />
<Tab label='Security' class='w-full justify-start border-l-2 border-b-0 border-transparent -ml-0.5' />
<Tab label='Billing' class='w-full justify-start border-l-2 border-b-0 border-transparent -ml-0.5' />
</Tabs> astro
<Tabs orientation="horizontal">
<Tab label="Active Users" active={true} />
<Tab label="Archived" />
<Button slot="extra" variant="primary" size="sm">
Add User
</Button>
</Tabs> API リファレンス
Tab
| プロパティ | 説明 | タイプ | デフォルト |
|---|---|---|---|
| variant | タブの視覚的スタイルのバリアント。 | 'line' | 'icon' | 'selector' | 'button' | 'pill' | 'enclosed' | 'line' |
| label | タブに表示されるテキストラベル。 | string | '-' |
| icon | ラベルの代わりに表示するLucideアイコン名(アイコンバリアント用)。 | IconName | '-' |
| iconLeft | ラベルの左側に表示するLucideアイコン名。 | IconName | '-' |
| iconRight | ラベルの右側に表示するLucideアイコン名。 | IconName | '-' |
| active | タブが現在選択されているかどうか。 | boolean | false |
| closable | タブに閉じるボタンを表示するかどうか。 | boolean | false |
| controls | このタブが制御するパネル要素のID(ARIA用)。 | string | '-' |
| disabled | タブを無効にし、操作を防止します。 | boolean | false |
Tabs
| プロパティ | 説明 | タイプ | デフォルト |
|---|---|---|---|
| orientation | Tabsのレイアウトの向き。 | 'horizontal' | 'vertical' | 'none' | 'none' |