Oddmash UI
所有组件

Dialog

打开用于编辑或确认的模态框。

用法

用于依赖当前页面上下文的操作,并提供关闭方法。

无障碍

提供 DialogTitle 和 DialogDescription,按 Escape 关闭后焦点回到触发器。

属性类型默认值
open / defaultOpenbooleanfalse
onOpenChange(open: boolean) => voidNone
theme (DialogContent)light | darkinherited
container (DialogContent)HTMLElementdocument.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>

交互式文档