Dinachi

Dialog

A modal window that overlays the main content, requiring user interaction before returning to the parent view.

View Source

#Installation

npx @dinachi/cli@latest add dialog

#Usage

tsx
import {
  Dialog,
  DialogTrigger,
  DialogContent,
  DialogViewport,
  DialogPopup,
  DialogBackdrop,
  DialogHeader,
  DialogTitle,
  DialogDescription,
  DialogFooter,
  DialogClose,
} from '@/components/ui/dialog'

#Examples

#API Reference

PropTypeDefaultDescription
openbooleanThe controlled open state of the dialog.
defaultOpenbooleanfalseThe initial open state for uncontrolled usage.
onOpenChange(open: boolean) => voidCallback fired when the open state changes.
modalboolean | 'trap-focus'trueWhether the dialog is modal. Prevents background interaction and traps focus.
DialogPopup.initialFocusboolean | RefObject | functionElement to focus when the dialog opens.
DialogPopup.finalFocusboolean | RefObject | functionElement to focus when the dialog closes.