Dialog
FeedbackModal dialog with overlay, title, description, and action buttons.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
DialogFooter,
DialogClose,
} from "@dashboardpack/core/components/ui/dialog";
import { Button } from "@dashboardpack/core/components/ui/button";
import { Input } from "@dashboardpack/core/components/ui/input";
import { Label } from "@dashboardpack/core/components/ui/label";
export default function DialogExample() {
return (
<div className="space-y-4">
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Edit profile</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
Try editing your name. This example does not persist changes.
</DialogDescription>
</DialogHeader>
<div className="space-y-2 p-4">
<Label htmlFor="dialog-name">Display name</Label>
<Input id="dialog-name" defaultValue="Alex Morgan" />
</div>
<DialogFooter>
<DialogClose asChild>
<Button>Done</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
);
}Usage
Compose a trigger, content, header, title, description, and footer. Use DialogClose around a single action child to dismiss. For asynchronous saves, control open yourself and close only after success.
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
DialogFooter,
DialogClose,
} from "@dashboardpack/core/components/ui/dialog";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| open / defaultOpen | booleanDefault: false | Controlled or initial open state. |
| onOpenChange | (open: boolean) => voidDefault: — | Respond to opening and dismissal. |
| asChild (DialogTrigger / DialogClose) | booleanDefault: false | Use a single child as the trigger or close control. |
| modal | booleanDefault: true | Trap focus and block background interaction. |