A modal, centered over a dimmed page: a square panel in a 10px frame of the process picture. A title bar holds an optional icon in a square, the title and the close icon button, above the body. It scales in, keeps focus inside and closes on Escape, a click outside or the close button. Actions sit in a bottom bar with the title bar’s padding (no top), in a row on the right (stacked full width on phones). The booking modal (BookCallDialog) is built on it.
Source: src/components/ui/dialog.tsx
The title bar, a description and a secondary action next to the main one.
"use client";
import { SendHorizontalIcon } from "@/components/icons/mage";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogBody,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
export default function DialogExample() {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="secondary">Open dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader icon={<SendHorizontalIcon />}>
<DialogTitle>Submit this request?</DialogTitle>
</DialogHeader>
<DialogBody>
<DialogDescription>
We start on it today and send the first cut within 48 hours.
</DialogDescription>
</DialogBody>
<DialogFooter>
<DialogClose asChild>
<Button variant="secondary">Cancel</Button>
</DialogClose>
<DialogClose asChild>
<Button>Submit</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
);
}