ACTIONS & SURFACES
Dialog
Modal dialog wrapping Radix Dialog. Two semantic modes via severity: default (informational, overlay closes) and alert (destructive confirmation, overlay does NOT close). A separate tone prop flips the offset shadow to the destructive token.
Import
Default — informational
Standard modal. Click on the overlay or press Esc to dismiss.
severity="alert" — destructive confirmation
Flip the role to alertdialog, block overlay-click dismissal, and remove the X button — the user must explicitly choose an action. Pair with tone="danger" to recolour the Memphis shadow.
When to switch to alert mode
- The action is destructive (delete, archive, sign out) and must NOT be cancelled accidentally by clicking outside.
- You want screen readers to announce the dialog as
alertdialog(more interruptive than the regulardialogrole). - Otherwise leave
severityatdefault.
Dialog (root) API
Dialog props
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | — | Controlled open state. Pair with onOpenChange. |
| defaultOpen | boolean | false | Uncontrolled initial open state. |
| onOpenChange | (open: boolean) => void | — | Fires whenever the open state changes. |
| modal | boolean | true | When true (default), focus is trapped inside the dialog and outside content is inert. |
DialogContent props
DialogContent severity/tone
| Prop | Type | Default | Description |
|---|---|---|---|
| severity | 'default' | 'alert' | 'default' | default is role="dialog"; clicks on the overlay close it. alert flips to role="alertdialog", blocks overlay-click dismissal and hides the X button — the user must click an explicit footer action. Use for destructive or otherwise irreversible flows. |
| tone | 'default' | 'danger' | 'default' | Visual override. danger swaps the Memphis offset shadow to the destructive token, telegraphing high-stakes actions. Orthogonal to severity — combine freely. |
| hideClose | boolean | false | Hide the built-in X close button. Already implicit when severity="alert" — alert mode never renders the X. |
Accessibility
- Always pair
DialogTitlewith the content; screen readers announce it as the dialog name. - Add
DialogDescriptionfor non-obvious actions; it is wired asaria-describedby. - Use
DialogCloseon close buttons so they close the dialog and return focus to the trigger. - In
severity="alert", place Cancel first in the footer DOM order so Radix gives it default focus — the layout enforces column-reverse on small viewports so Cancel sits on top there.