Button
ボタンは、ユーザーがアクションを実行するための最も基本的なインタラクティブ要素です。クリック、タップで操作を開始し、フォーム送信やナビゲーションなど様々な用途に使用します。
4
Variants
4
Colors
5
Sizes
Pure
React
Playground
プレビュー
solidD40px / 14pxW 600
Variant
Color
Size
Radius
Icon
Weight
Width
State
Label
<Button>Button</Button>Variants
Style
Solid
ソリッド背景。最も視覚的に目立つスタイル。
送信、保存、購入
Outline
中立的なアクション。背景と調和させたい場合。
詳細を見る、編集
Ghost
最小限の視覚的存在感。ツールバーなどに最適。
ツールバー、ナビ
Link
テキストリンクスタイル。インラインアクションに。
もっと見る、詳細
Solid Colors
Default
ダークカラー。最も汎用的なCTA。
送信、保存
Primary
ブランドカラー。ブランドを強調するアクション。
サインアップ
Secondary
補助的なアクション。プライマリと並べて使用。
キャンセル、戻る
Destructive
破壊的なアクション。削除や取消不能な操作に。
削除、リセット
Sizes
xs高さ28px
横パディング10px
Gap4px
アイコン14px
フォント12px
sm高さ32px
横パディング12px
Gap8px
アイコン14px
フォント13px
md高さ36px
横パディング14px
Gap8px
アイコン16px
フォント14px
default高さ40px
横パディング16px
Gap8px
アイコン16px
フォント14px
lg高さ48px
横パディング24px
Gap8px
アイコン16px
フォント16px
| Size | 高さ | 横パディング | Gap | アイコン | フォント | プレビュー |
|---|---|---|---|---|---|---|
xs | 28px | 10px | 4px | 14px | 12px | |
sm | 32px | 12px | 8px | 14px | 13px | |
md | 36px | 14px | 8px | 16px | 14px | |
default | 40px | 16px | 8px | 16px | 14px | |
lg | 48px | 24px | 8px | 16px | 16px |
タッチターゲット: WCAG 2.5.8基準では最小24pxのタッチ領域が必要です。最小のxs(28px)でもWCAG基準を満たしています。
Features
With Icons
<Button variant="outline" leftIcon={<Search />}>検索</Button>
<Button variant="outline" rightIcon={<ChevronRight />}>続ける</Button>
<Button variant="outline" leftIcon={<Search />} rightIcon={<ChevronRight />}>
検索する
</Button>States
Solid Primary
Outline
// Solid Primary States
<Button color="primary">Default</Button>
<Button color="primary" loading>Loading</Button>
<Button color="primary" disabled>Disabled</Button>
// Outline States
<Button variant="outline">Default</Button>
<Button variant="outline" loading>Loading</Button>
<Button variant="outline" disabled>Disabled</Button>API
Props
variant"solid""solid" | "outline" | "ghost" | "link"ボタンのスタイル。solid=600、outline/ghost/link=400のフォント太さ
color"default""default" | "primary" | "secondary" | "destructive"solidバリアントの色(default=ダーク、primary=ブランド、secondary=セカンダリ、destructive=エラー)。solid以外では無視
size"default""xs" | "sm" | "md" | "default" | "lg" | "icon"ボタンの高さとパディング
radius"default""none" | "sm" | "base" | "default" | "lg" | "xl" | "2xl" | "3xl" | "full"角丸のサイズ (6px)
fullWidthfalseboolean幅100%で表示
loadingfalsebooleanローディング状態
disabledfalseboolean無効状態
leftIconundefinedReactNode左側アイコン
rightIconundefinedReactNode右側アイコン
fontWeightundefined"normal" | "semibold"フォント太さの上書き。未指定時はvariantデフォルト(solid系=600, outline/ghost/link=400)。直接prop > ButtonGroupコンテキスト > variantデフォルトの優先順位
selectedfalseboolean選択状態(outline/ghostのみ対応)。outlineはbg-background-muted、ghostはfont-semibold。他のvariantでは効果なし
pressEffectundefinedbooleanプレスエフェクト(active:scale-pressed)。未指定時はtrueとして動作。falseで無効化
asChildfalsebooleanSlotとしてレンダリング
| Name | Type | Default | Description |
|---|---|---|---|
variant | "solid" | "outline" | "ghost" | "link" | "solid" | ボタンのスタイル。solid=600、outline/ghost/link=400のフォント太さ |
color | "default" | "primary" | "secondary" | "destructive" | "default" | solidバリアントの色(default=ダーク、primary=ブランド、secondary=セカンダリ、destructive=エラー)。solid以外では無視 |
size | "xs" | "sm" | "md" | "default" | "lg" | "icon" | "default" | ボタンの高さとパディング |
radius | "none" | "sm" | "base" | "default" | "lg" | "xl" | "2xl" | "3xl" | "full" | "default" | 角丸のサイズ (6px) |
fullWidth | boolean | false | 幅100%で表示 |
loading | boolean | false | ローディング状態 |
disabled | boolean | false | 無効状態 |
leftIcon | ReactNode | undefined | 左側アイコン |
rightIcon | ReactNode | undefined | 右側アイコン |
fontWeight | "normal" | "semibold" | undefined | フォント太さの上書き。未指定時はvariantデフォルト(solid系=600, outline/ghost/link=400)。直接prop > ButtonGroupコンテキスト > variantデフォルトの優先順位 |
selected | boolean | false | 選択状態(outline/ghostのみ対応)。outlineはbg-background-muted、ghostはfont-semibold。他のvariantでは効果なし |
pressEffect | boolean | undefined | プレスエフェクト(active:scale-pressed)。未指定時はtrueとして動作。falseで無効化 |
asChild | boolean | false | Slotとしてレンダリング |
Anatomy
1
2
3
Button1
Container
外枠 · border-radius · 背景色
2
Icon
左右に配置可能 · オプション
3
Label
テキストラベル · 必須
4
Gap
要素間の余白
Best Practices
✓
推奨
- ✓1ページに1つのプライマリボタン
- ✓アクション指向のラベル(「送信」「保存」)
- ✓非同期操作にはローディング状態を表示
- ✓十分なタッチ領域を確保(WCAG 2.5.8: 24px以上)
✕
避けるべき
- ✗複数のプライマリボタンを並べない
- ✗「ここをクリック」のような曖昧なラベル
- ✗理由なくボタンを無効化しない
- ✗安全な操作に destructive を使わない
Accessibility
キーボード操作
Tabフォーカス移動
Enterボタン実行
Spaceボタン実行
WCAG 2.2 準拠
- コントラスト比 4.5:1 以上
- フォーカスインジケーター
- native disabled 属性
- aria-busy (loading時に自動付与)
- aria-hidden (アイコンに自動付与)
- aria-pressed (selected時に自動付与)