Segmented
Segmentedは、排他的な単一選択を提供するピル型のコントロールです。 タブやフィルターの切り替えに最適です。
Playground
<Segmented defaultValue="play">
<SegmentedItem value="prev">Prev</SegmentedItem>
<SegmentedItem value="play">Play</SegmentedItem>
<SegmentedItem value="next">Next</SegmentedItem>
</Segmented>Variants
defaultPill StyleoutlineBordered StyleunderlineTab StyleghostMinimal StyleSizes
Text Only
smmddefaultlg| Size | 高さ | 横パディング | フォント | プレビュー |
|---|---|---|---|---|
sm | 32px | 14px | 12px | |
md | 36px | 14px | 13px | |
default | 40px | 16px | 13px | |
lg | 48px | 24px | 14px |
Icon Only (正方形)
smmddefaultlg| Size | コンテナ高さ | アイテムサイズ | アイコン | プレビュー |
|---|---|---|---|---|
sm | 32px | 24px × 24px | 14px | |
md | 36px | 28px × 28px | 16px | |
default | 40px | 32px × 32px | 16px | |
lg | 48px | 40px × 40px | 16px |
Icon + Text
smmddefaultlg| Size | 高さ | 横パディング | Gap | アイコン | フォント | プレビュー |
|---|---|---|---|---|---|---|
sm | 32px | 12px | 8px | 14px | 12px | |
md | 36px | 14px | 8px | 16px | 13px | |
default | 40px | 16px | 8px | 16px | 13px | |
lg | 48px | 24px | 8px | 16px | 14px |
Features
Use Cases
Notion, Linear, タスク管理アプリ
Stripe, Google Analytics, ダッシュボード
Figma, Notion, プロジェクト管理ツール
SaaS料金ページ、サブスクリプション
States
Default
選択されたアイテムはハイライト表示。
Disabled
全アイテムが無効化されたStates。
個別 Disabled
特定のアイテムのみ無効化。
多数のアイテム
2〜5個のアイテムに最適。
API
Component Structure
Segmented— Radix RadioGroup.ItemPropsセグメントアイテムProps
Segmented
valueundefinedstring制御モードでの選択値
defaultValueundefinedstring非制御モードでの初期選択値
onValueChangeundefined(value: string) => void選択変更時のコールバック
variant"default""default" | "outline" | "underline" | "ghost"スタイルバリアント(default: iOS風, outline: ボーダー風, underline: Stripe風, ghost: Notion風)
size"default""sm" | "md" | "default" | "lg"セグメントのサイズ (32/36/40/48px)
radius"default""none" | "sm" | "base" | "default" | "lg" | "xl" | "2xl" | "3xl" | "full"角丸のサイズ (6px)
fontWeight"normal""normal" | "semibold"フォントの太さ(全variantでnormalがデフォルト)
disabledfalseboolean全アイテム無効States
| Name | Type | Default | Description |
|---|---|---|---|
value | string | undefined | 制御モードでの選択値 |
defaultValue | string | undefined | 非制御モードでの初期選択値 |
onValueChange | (value: string) => void | undefined | 選択変更時のコールバック |
variant | "default" | "outline" | "underline" | "ghost" | "default" | スタイルバリアント(default: iOS風, outline: ボーダー風, underline: Stripe風, ghost: Notion風) |
size | "sm" | "md" | "default" | "lg" | "default" | セグメントのサイズ (32/36/40/48px) |
radius | "none" | "sm" | "base" | "default" | "lg" | "xl" | "2xl" | "3xl" | "full" | "default" | 角丸のサイズ (6px) |
fontWeight | "normal" | "semibold" | "normal" | フォントの太さ(全variantでnormalがデフォルト) |
disabled | boolean | false | 全アイテム無効States |
SegmentedItem
value必須stringアイテムの一意な値
disabledfalseboolean個別の無効States
size親から継承"sm" | "md" | "default" | "lg"個別のサイズ上書き
radius親から継承"none" | "sm" | ... | "full"個別の角丸上書き
contentType"text""text" | "icon-text" | "icon"コンテンツタイプ(icon: 正方形、icon-text: gap付き、text: 標準)
| Name | Type | Default | Description |
|---|---|---|---|
value | string | 必須 | アイテムの一意な値 |
disabled | boolean | false | 個別の無効States |
size | "sm" | "md" | "default" | "lg" | 親から継承 | 個別のサイズ上書き |
radius | "none" | "sm" | ... | "full" | 親から継承 | 個別の角丸上書き |
contentType | "text" | "icon-text" | "icon" | "text" | コンテンツタイプ(icon: 正方形、icon-text: gap付き、text: 標準) |
Customization
すべてのアイテムはデザインシステムのスペーシングルールに基づいたデフォルト値を使用します。 グループのclassNameで全アイテムを一括カスタマイズできます。
横パディングの変更
className="[&>button]:px-10"Icon Onlyの幅変更
className="[&>button]:aspect-auto [&>button]:px-5"Tip:デフォルト値はコンポーネントの一貫性を保つよう設計されています。UI実装上カスタマイズが必要な場合にご活用ください。
Segmented vs Tabs
似たような見た目ですが、用途と構造が異なります。適切なコンポーネントを選択してください。
用途
Segmented: 値の選択(フィルター、切替)
Tabs: コンテンツナビゲーション
構造
Segmented: 単独コンポーネント
Tabs: TabList + TabPanel の組み合わせ
結果
Segmented: 同じエリア内のデータ変更
Tabs: パネルの切替表示
配置
Segmented: コンテンツ内、どこでも
Tabs: ページ/セクションの上部
Radix Primitive
Segmented: RadioGroup
Tabs: @radix-ui/react-tabs
| 特徴 | Segmented | Tabs |
|---|---|---|
| 用途 | 値の選択(フィルター、切替) | コンテンツナビゲーション |
| 構造 | 単独コンポーネント | TabList + TabPanel の組み合わせ |
| 結果 | 同じエリア内のデータ変更 | パネルの切替表示 |
| 配置 | コンテンツ内、どこでも | ページ/セクションの上部 |
| Radix Primitive | RadioGroup | @radix-ui/react-tabs |
使い分けのポイント: Segmentedは「同じコンテンツエリア内で表示を変える」場合に使用。 Tabsは「異なるコンテンツパネルを切り替える」場合に使用します。