Color
Typography
Spacing
Radius
Border
Opacity
Elevation
Blur
Avatar
Badge
Button
Checkbox
Input
ProgressBar
RadioButton
Separator
Slider
Switch
TextArea
TextLink
Accordion
Breadcrumb
ButtonGroup
Combobox
DropdownMenu
ListItem
Pagination
SegmentedControl
Select
Tooltip
Calendar
Card
CommandMenu
DatePicker
Dialog
Drawer
EmptyState
Footer
Form
NavigationBar
Sidebar
Skeleton
Table
Tabs
Toaster

Dialog

Asks for a decision or shows focused content on top of the page: a title, a description, optional content, then the actions. Destructive marks an action that cannot be undone.

Dialog title

Add supporting information to help people understand the decision.

Type

Usage

Import the component and render it.

import { Dialog } from 'src/components/Dialog/Dialog';
import { Button } from 'src/components/Button/Button';

<Dialog
  type="default"
  title="Dialog title"
  description="Add supporting information to help people understand the decision."
  primaryAction="Continue"
  secondaryAction="Cancel"
  dismissible
  trigger={<Button variant="outline" size="sm">Open dialog</Button>}
/>

Accessibility

Role: dialog (alertdialog when Destructive), named by the title and described by the description; modal with showModal().

KeyAction
Tab / Shift+TabMoves through the dialog’s controls only (the page behind is inert)
EscapeCloses the dialog
Enter / SpaceActivates the focused Button
  • Opening moves focus into the dialog (to Cancel when Destructive, the safe choice); closing returns it to the trigger.
  • A click outside the panel closes Default, never Destructive.
  • Close is an icon-only Button whose label ("Close") is its accessible name.

Type

Set the type prop: Default is "default", Destructive is "destructive".

Dialog title

Add supporting information to help people understand the decision.

Default

Dialog title

Add supporting information to help people understand the decision.

Destructive
<Dialog type="default" title="Dialog title" primaryAction="Continue" />
<Dialog type="destructive" title="Dialog title" primaryAction="Continue" />

Composition

Use the following composition to build a Dialog:

Dialog
├── Button
└── Separator

Actions

Pass callbacks to respond to the component.

import { Dialog } from 'src/components/Dialog/Dialog';
import { Button } from 'src/components/Button/Button';

<Dialog
  type="default"
  title="Dialog title"
  description="Add supporting information to help people understand the decision."
  primaryAction="Continue"
  secondaryAction="Cancel"
  dismissible
  trigger={<Button variant="outline" size="sm">Open dialog</Button>}
  onPrimaryAction={() => console.log('onPrimaryAction')}
  onSecondaryAction={() => console.log('onSecondaryAction')}
  onOpenChange={(open) => console.log(open)}
/>
CallbackWhen
onPrimaryActionCalled when the primary action is activated.
onSecondaryActionCalled when the secondary action is activated.
onOpenChangeCalled when the dialog opens or closes (trigger, actions, Close, Esc, backdrop).