Docs
Dialog
A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
import * as React from "react"; import { css } from "@pigment-css/react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { Field, FieldLabel } from "@/components/ui/field"; import { Input } from "@/components/ui/input"; export function DialogExample(): React.JSX.Element { return ( <Dialog> <DialogTrigger render={<Button variant="outline">Edit Profile</Button>} /> <DialogOverlay /> <DialogContent className={css({ maxWidth: "425px" })}> <DialogHeader> <DialogTitle>Edit Profile</DialogTitle> <DialogDescription> Make changes to your profile here. Click save when you're done. </DialogDescription> </DialogHeader> <div className={css({ display: "grid", gap: "calc(var(--spacing-unit) * 3)", paddingBlock: "calc(var(--spacing-unit) * 3)", })} > <Field className={css({ alignItems: "center", display: "grid", gridTemplateColumns: "1fr 3fr", })} > <FieldLabel className={css({ textAlign: "end" })}>Name</FieldLabel> <Input defaultValue="John Doe" /> </Field> <Field className={css({ alignItems: "center", display: "grid", gridTemplateColumns: "1fr 3fr", })} > <FieldLabel className={css({ textAlign: "end" })}>Username</FieldLabel> <Input defaultValue="@john.doe" /> </Field> </div> <DialogFooter> <DialogClose render={<Button>Save Changes</Button>} /> </DialogFooter> </DialogContent> </Dialog> ); }
npx lotru@latest add ui/dialog
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog";
<Dialog> <DialogTrigger>Open</DialogTrigger> <DialogOverlay /> <DialogContent> <DialogHeader> <DialogTitle>Are you absolutely sure?</DialogTitle> <DialogDescription> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </DialogDescription> </DialogHeader> </DialogContent> </Dialog>
Previous
Collapsible
Next
Drawer
On this page