Dialog
編集や確認のためにモーダルを開きます。
使い方
現在の画面が文脈となる操作に使い、閉じる手段を用意します。
アクセシビリティ
DialogTitle と DialogDescription を付けます。Escape で閉じるとフォーカスが戻ります。
| プロパティ | 型 | 既定値 |
|---|---|---|
| open / defaultOpen | boolean | false |
| onOpenChange | (open: boolean) => void | None |
| theme (DialogContent) | light | dark | inherited |
| container (DialogContent) | HTMLElement | document.body |
<Dialog>
<DialogTrigger asChild><Button>Edit project</Button></DialogTrigger>
<DialogContent>
<DialogTitle>Project settings</DialogTitle>
<DialogDescription>Give your project a name.</DialogDescription>
<label htmlFor="name">Name</label>
<Input id="name" defaultValue="Interaction Inspector" />
<DialogClose asChild><Button>Done</Button></DialogClose>
</DialogContent>
</Dialog>