Dialog

A modal dialog for confirmations, forms, and alerts.

Install

npx @beaket/ui add dialog

Import

import { Dialog } from "@/components/ui/dialog"

Examples

States

Props

NameTypeDefaultDescription
preventCloseboolean | undefinedfalseWhen true, prevents closing the dialog via ESC key or clicking outside. Users must use the close button or action buttons to dismiss the dialog.
hideCloseButtonboolean | undefinedfalseWhen true, hides the X close button in the top-right corner. Useful with preventClose when you want users to use only action buttons.
triggerReactNodeElement that opens the dialog when clicked. Can be any clickable element like Button, link, or custom trigger. Optional - if not provided, dialog must be controlled via open/onOpenChange props.
childrenReactNodeDialog content including Header, Description, Footer, and custom elements
openboolean | undefinedControlled open state of the dialog. When provided, you must also provide onOpenChange to handle state updates.
onOpenChange((open: boolean) => void) | undefinedCallback when the open state changes. Required when using controlled mode (open prop).
closeWhenunknownWhen this value becomes truthy, automatically close the dialog. Useful for closing dialog after successful form submission via React Router action.