Skip to content

Dialog

Feedback

Modal dialog with overlay, title, description, and action buttons.

Editable contentClose action
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

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
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.

Dialog props
PropType / DefaultDescription
open / defaultOpenboolean

Default: false

Controlled or initial open state.
onOpenChange(open: boolean) => void

Default: —

Respond to opening and dismissal.
asChild (DialogTrigger / DialogClose)boolean

Default: false

Use a single child as the trigger or close control.
modalboolean

Default: true

Trap focus and block background interaction.

Build with these too