Dialog

A modal that interrupts the user with important content.

Default

A focused task with a title, fields and a footer. DialogClose renders the footer buttons so both actions close the dialog.

Close button

Pass showCloseButton for long or scrollable content. The body scrolls under a fixed footer; pad the header so the title clears the button.

Destructive

Lead with DialogIcon, name the object in the title and action, and put the consequence in a DialogNotice. Keep the action disabled until the name is typed.

Multi-step

DialogStepBody slides each step in from the direction of travel and animates the height between steps. Keep progress and the footer actions in place.

Controlled

Pass open and onOpenChange to open the dialog from code, such as after a file is chosen or from a menu item.

Best practices

When to use

  • Use for a focused task or decision that blocks the page until it is completed or dismissed, such as “Create view” or “Rename agent”.
  • Use Drawer for supporting detail that can sit beside the page, Alert Dialog for a yes/no decision with no fields, and a full page for a long creation flow.

Behavior

  • Render footer actions with DialogClose render={<Button />} so every action closes the dialog; use open and onOpenChange only when code must open it or keep it open (validation, async save).
  • Pass showCloseButton for long or scrollable content and add pr-8 to DialogHeader so the title clears it. DialogBody scrolls; DialogFooter stays fixed.
  • For multi-step flows use DialogStepBody with step and direction (1 forward, -1 back), keep the Stepper and footer in place, and swap Cancel for Back after the first step.
  • Non-destructive dialogs dismiss with Escape or an outside click. For destructive work, name the object and keep the action disabled until the confirmation matches.

Content

  • Title and primary action use the same verb and object in sentence case: title “Delete agent”, action “Delete agent”, never “OK” or “Confirm”.
  • One primary Button per footer. Cancel is variant="transparent"; destructive actions are variant="danger" with a DialogIcon and a DialogNotice stating the consequence.
  • Pass separated={false} on DialogFooter only for short dialogs with one field.

Accessibility

  • Always include DialogTitle; add DialogDescription when the title alone does not explain the task. Both are announced on open.
  • Focus moves into the dialog, stays trapped while open and returns to the trigger on close.