overlay
A modal window for a focused task, like editing a record. Blocks the page until closed.
npx blankui add dialogThe title is a prop on DialogContent, so a dialog can never be missing its accessible name. BlankUI does not export DialogHeader, DialogTitle or DialogDescription.
import {
Dialog,
DialogClose,
DialogContent,
DialogFooter,
DialogTrigger,
} from "@/components/ui/dialog"
<Dialog>
<DialogTrigger asChild>
<Button>Edit profile</Button>
</DialogTrigger>
<DialogContent title="Edit profile" description="Changes are saved when you click Save.">
<Stack gap={4}>
<Field label="Name">
<Input defaultValue="Ada" />
</Field>
</Stack>
<DialogFooter>
<DialogClose asChild>
<Button variant="outline">Cancel</Button>
</DialogClose>
<Button type="submit">Save</Button>
</DialogFooter>
</DialogContent>
</Dialog>
const [open, setOpen] = useState(false)
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent title="Invite people">...</DialogContent>
</Dialog>
title (required), descriptionhideTitle: keeps the title for screen readers onlysize: sm, md (default), lgshowCloseButton: defaults to true| Avoid | Instead |
|---|---|
| <DialogHeader><DialogTitle>...</DialogTitle></DialogHeader> (shadcn style) | <DialogContent title="..." description="..."> (BlankUI renders the header) |
| A Dialog with no visible title | <DialogContent title="Search" hideTitle> keeps it for screen readers |
| Using Dialog to confirm a delete | <AlertDialog> |
| <DialogClose><Button>Cancel</Button></DialogClose> (a button inside a button) | <DialogClose asChild><Button variant="outline">Cancel</Button></DialogClose> |
Install with the shadcn CLI: npx shadcn add https://blank.vageshwar.dev/r/dialog.json