Dialog
A modal dialog with passive / transactional / danger variants.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
- Use it when A focused, interruptive task or confirmation that must be resolved before continuing.
- Reach for something else when Non-blocking messages (use
Alert/toast) or large workflows (use a page).
Accessibility
Focus is trapped and returned to the trigger on close, Esc dismisses, and the backdrop is inert. Title wires aria-labelledby; variant="danger" still announces as a dialog.
Install and import
npx shadcn@latest add @prism/dialog
import { Dialog } from '@/components/prism/Dialog';
In a no-build prototype, read it from the bundle instead: const { Dialog } = window.PrismDesignSystem_39d121;
Examples
Transactional
<Dialog isOpen={open} onClose={close} title="Invite a member"
primaryLabel="Send invite" onPrimary={send}>
<TextField label="Email" type="email" />
</Dialog>
Danger
<Dialog isOpen={open} onClose={close} variant="danger" size="sm"
title="Delete workspace" primaryLabel="Delete" onPrimary={destroy}>
This can’t be undone.
</Dialog>
Props
| Prop | Type | Required | Description |
|---|---|---|---|
isOpen | boolean | Yes | |
onClose | () => void | — | |
title | React.ReactNode | — | |
size | "xs" | "sm" | "md" | "lg" | "full" | — | Width (a sheet's width too). "full" fills the viewport — a lightbox or media viewer. |
placement | "center" | "end" | — | "center" (default) or "end": a side sheet from the inline-end edge, full height (left edge in RTL). |
backdrop | "default" | "dark" | — | "dark": a near-black backdrop, and the dialog renders in the dark scheme (lightbox, media). |
isTitleHidden | boolean | — | Keep the title for screen readers (it still names the dialog) but don't show it; the close × stays. |
onPrevious | () => void | — | ArrowLeft (ArrowRight in RTL) steps back — not while typing in a field. |
onNext | () => void | — | ArrowRight (ArrowLeft in RTL) steps forward — not while typing in a field. |
variant | "passive" | "transactional" | "danger" | — | Intent-based variant (Carbon approach): - "passive": informational, no actions, freely dismissable. - "transactional": requires a choice; background click won't dismiss. - "danger": transactional with a destructive primary action. Inferred from the action props when omitted. |
primaryLabel | string | — | Primary action label — renders the standard footer. |
onPrimary | () => void | — | |
secondaryLabel | string | — | Secondary/cancel label. Default "Cancel". |
onSecondary | () => void | — | |
isPrimaryDisabled | boolean | — | |
dismissable | boolean | — | Override whether scrim-click/Esc dismiss. Defaults by variant. |
footer | React.ReactNode | — | Custom footer node (overrides the generated action buttons). |
role | "dialog" | "alertdialog" | — | Override the role. Default: "alertdialog" for variant="danger", else "dialog" (a form dialog is a dialog). |
initialFocusRef | React.RefObject<HTMLElement | null> | — | The element to focus on open (e.g. a Cancel button). Focus still returns to the trigger on close — unlike autoFocus. |
children | React.ReactNode | — |