ActionDialog
Dialog の variant。ユーザーに確認や単純な操作を求めるためのダイアログ。フォーム要素を含まない確認・実行のシーンで使う。ダイアログ表示中は裏側の領域がスクリムで隠れ、操作を受け付けない。
プレビュー
トリガーを押すとダイアログが開く。フッターは右寄せに Cancel / Action の 2 ボタン。
実装例
import { Button } from "@/components/Button";
import {
Dialog,
DialogClose,
DialogContent,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
export function Example() {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="primary" size="m">タグを登録</Button>
</DialogTrigger>
<DialogContent
showCloseButton={false}
className="!w-[var(--width-dialog-s)] !max-w-none !gap-0 !p-0 !ring-0 shadow-layer-4 overflow-hidden"
>
<div className="p-[var(--spacing-xs)] border-b border-[var(--border-default)] bg-[var(--bg-surface)]">
<DialogTitle className="!text-[length:var(--font-size-l)] !font-medium !leading-[1.25]">
タグを登録しますか?
</DialogTitle>
</div>
<div className="p-[var(--spacing-xs)] bg-[var(--bg-surface)] text-[color:var(--text-primary)] tds-text-body-m">
この顧客に「重要顧客」タグを付与します。
</div>
<div className="p-[var(--spacing-xs)] border-t border-[var(--border-default)] bg-[var(--bg-surface)] flex items-center justify-end gap-[var(--spacing-xxs)]">
<DialogClose asChild>
<Button variant="secondary" size="s">キャンセル</Button>
</DialogClose>
<DialogClose asChild>
<Button variant="primary" size="s">登録</Button>
</DialogClose>
</div>
</DialogContent>
</Dialog>
);
}仕様
- primitive:
src/components/ui/dialog.tsxをベースに Figma 仕様のヘッダー / ボディ / フッター 3 枠構造でラップする - 幅:
var(--width-dialog-s)(424px 相当) - ヘッダー:
p-16 / border-b、タイトル 20px medium - ボディ:
p-16、本文 16px - フッター:
p-16 / border-t、右寄せに Cancel + Action ボタン (gap: 4px) - 閉じるボタン(×)は表示しない (
showCloseButton=false)。Esc / overlay click で閉じる - shadow:
shadow-layer-4
使い分け
- ActionDialog: 単純な操作の確認 (削除以外の登録・実行など)。フォーム要素は含まない
- FormDialog (未実装): 入力フォームを含むダイアログ
- AlertDialog: 取り消し不可の最終確認 (削除・送信)。Esc / overlay click で閉じない
- MessageDialog: 情報提示のみ。ボタンは閉じるのみ