Dialog
A modal surface for one small job: a question to answer, one small form to fill in, or a destructive action to confirm.
When to use
- To ask one question or confirm one choice before the person goes on (D-CSN-21).
- For one small form: a one-field edit on a settings page, a short report. At most about three fields (canonical §10.19).
- To confirm an action that cannot be undone: signing out of a device, removing a passkey, suspending an account (D-BCP-20).
- From 768px. Below 768px the same content opens as a bottom sheet; when one piece of content opens at every width, use the responsive modal (
.oa-modal, below), which switches by itself (D-CSN-22).
When not to use
- A task with more than about three fields, or content wider than 560px: make it a page (canonical §10.19).
- Feedback after an action ("Mobile number saved"): a snackbar (D-CSN-25). Validation and server problems never open a dialog of their own: field errors carry the first, an error banner above the main button the second (canonical §10.4).
- Navigation: the side sheet holds the phone menu and the admin drawer.
- Help or details next to a control: a popover. A short label for an icon button: a tooltip.
- Nothing to decide: say it on the page.
Anatomy
- Scrim: black at 32% over the page,
--color-scrimin both themes. Native dialogs draw it withdialog::backdrop; Radix renders it as.oa-scrim. - Container (
.oa-dialog):surface-raised,rounded-sheet(28px),shadow-elevation-3, a transparent 1px edge, 24px padding. - Header (
.oa-dialog__header), 24px above the body:- Title (
.oa-dialog__title): an<h2>inheadline-sm,on-surface. It names the dialog. - Description (
.oa-dialog__desc, optional): one or two sentences inbody-md,on-surface-variant, 8px under the title. It describes the dialog. - Close button (
.oa-dialog__closeon a 48px icon button): the close icon, named "Close", 8px from the top and the inline end. The title keeps 40px clear of it.
- Title (
- Body (
.oa-dialog__body, optional): the only part that scrolls; a form is the body itself (<form class="oa-dialog__body">), fields 20px apart. - Action row (
.oa-dialog__actions, with the row class.oa-actionsof button.md): Cancel first, the main button last at the inline end, 8px apart, 24px under the body.
Variants
| Variant | Use for | Key classes and tokens |
|---|---|---|
| Basic | A statement or a question in one or two sentences, with one or two actions | .oa-dialog; focus starts on the main button |
| Form | One small form; Cancel and a verb with the check icon ("Save") | <form class="oa-dialog__body" novalidate>, fields --space-fields apart; focus starts in the first field |
| Confirm destructive | An action that cannot be undone: the title asks and names the thing, the body says what is lost | [role="alertdialog"], the main button .oa-btn--danger; focus starts on Cancel |
| Long form | Up to about three fields whose body scrolls | .oa-dialog__actions--sticky: a 1px --color-outline-variant edge across the full width above the actions |
| Responsive modal | The same content at every width: a bottom sheet below 768px, a dialog from 768px | .oa-modal with .oa-sheet__handle and the footer .oa-actions--modal |
The three content types (basic, form, confirm destructive) are canonical §10.19; the long-form row is Global Jobs' sticky footer (D-CSN-21).
Sizes
One size, so forms stay predictable (D-CSN-21, D-LAY-06).
| Part | Size | Token |
|---|---|---|
| Width | calc(100% - 2rem), at most 560px |
--container-dialog (max-w-dialog) |
| Height | its content, at most calc(100dvh - 2rem) minus the top and bottom safe-area insets; the body scrolls beyond that, and a modal dialog centers between the insets, so its title and Close stay out of the notch |
max-h-[calc(100dvh-2rem)]; reference CSS --oa-safe-top, --oa-safe-bottom (canonical §4.10) |
| Padding | 24px on every side | --space-card-medium (p-card-medium) |
| Gaps | header to body and body to actions 24px; title to description 8px; field to field 20px; button to button 8px | --space-stack-loose, --space-stack-tight, --space-fields, --space-2 |
| Close button | 48 × 48px with a 24px icon, 8px from the top and the inline end | --size-button-md, --size-icon-lg, --space-2 |
| Buttons | md (48px), labels in label-lg |
.oa-btn default size (canonical §10.1) |
Tokens
| Part | Property | Token (CSS · Tailwind) |
|---|---|---|
| Scrim | background | --color-scrim · bg-scrim (black 32%, both themes) |
| Container | background | --color-surface-raised · bg-surface-raised (white light, #322823 dark) |
| Container | text | --color-on-surface · text-on-surface |
| Container | shadow | --shadow-elevation-3 · shadow-elevation-3 |
| Container | edge | 1px solid transparent · border border-transparent (drawn in forced colors) |
| Container | corners | --radius-sheet · rounded-sheet (28px) |
| Container | layer (element version) | --z-modal · z-50; a native modal sits in the top layer |
| Title | type, color | --text-headline-sm · text-headline-sm; --color-on-surface |
| Description | type, color | --text-body-md · text-body-md; --color-on-surface-variant · text-on-surface-variant |
| Header | clearance for the close button | --space-10 · pe-10 (40px) |
| Sticky action row | edge, padding | 1px --color-outline-variant · border-outline-variant; --space-4 above the buttons |
| Motion | enter, exit | --duration-short-3, --ease-emphasized; exit --ease-emphasized-accelerate; the scrim enters with --ease-standard |
States
| State | What changes |
|---|---|
| Closed | Not rendered: a closed <dialog> is display: none. |
| Opening | The scrim fades in over duration-short-3 with ease-standard; the container fades and scales from 0.95 to 1 over duration-short-3 with ease-emphasized (D-SEM-16). |
| Open | Focus is inside and held there; the page behind is inert and does not scroll. |
| Closing | Container and scrim fade out over duration-short-3 with ease-emphasized-accelerate (the container scales back to 0.95 as it goes); focus returns to the opener. |
| Busy (form sent) | The main button keeps its colors and focus: [aria-busy="true"] with [aria-disabled="true"], the label "Saving…" and a spinner, presses ignored, width locked. Cancel stays usable (D-CAI-06). |
| Error | Field errors inside the form (text, icon, [aria-invalid="true"]); a server problem shows as an error banner at the end of the body, above the actions, with role="alert" (canonical §10.4). |
| Controls | Buttons and the close button carry their own hover (8%), pressed (12%), focus ring, and disabled states (button.md, icon-button.md). The container itself has none. |
Behavior
- Open it modally. Framework-free: a native
<dialog>opened withshowModal(); it brings the top layer, the inert page, focus containment, Escape, and focus return. Never open it by writing the[open]attribute: that opens it without the scrim, the inert page, or Escape. React: Radix Dialog (D-CSN-21). - Initial focus (canonical §10.19): the first field of a form; Cancel in a destructive confirm; the main button in a basic dialog. Mark that element with
autofocus; otherwise the close button, first in the order, would take focus. - Ways out: Escape, a press on the scrim, the close button, and Cancel. All of them close without acting; focus returns to the element that opened the dialog.
- The page behind is inert and does not scroll: overlay.css sets
:root:has(dialog:modal) { overflow: hidden }; Radix locks the scroll itself. - Long content: the header and the action row stay; only the body scrolls. A task that needs more than that is a page.
- After a form saves: close the dialog, then confirm in the snackbar with Undo when the change can be undone: "Preferred name saved" · "Undo" → "Change undone" (forms and settings, canonical §11 row 6).
- One content, two containers: below 768px the same content is a bottom sheet. Products choose the container when they open it (Global ID's
useIsWide), or write.oa-modal, which switches with the window (D-CSN-22). - Motion: see States. Under reduced motion base.css switches every transition off and the dialog appears and leaves at once; never wait for
transitionend(D-SEM-21).
The script contract for the framework-free reference:
// Open from its trigger. The element with autofocus takes focus.
trigger.addEventListener('click', () => dialog.showModal());
// A press on the scrim lands on the <dialog> itself, outside its box. Check where the press
// started too, so selecting text in a field and letting go over the scrim never closes it.
const onScrim = (event) => {
if (event.target !== dialog) return false;
const box = dialog.getBoundingClientRect();
return event.clientX < box.left || event.clientX > box.right ||
event.clientY < box.top || event.clientY > box.bottom;
};
let pressStartedOnScrim = false;
dialog.addEventListener('pointerdown', (event) => { pressStartedOnScrim = onScrim(event); });
dialog.addEventListener('click', (event) => {
if (pressStartedOnScrim && onScrim(event)) dialog.close();
});
// Close and Cancel close without acting. Escape is native (the cancel event).
dialog.querySelector('.oa-dialog__close').addEventListener('click', () => dialog.close());
cancelButton.addEventListener('click', () => dialog.close());
// close() returns focus to the opener; nothing waits for transitionend.Where the browser supports it, closedby="any" on the <dialog> closes it on a scrim press natively; keep the script for the others.
Accessibility
- Role: the native
<dialog>is a dialog, andshowModal()makes it modal for assistive technology; a destructive confirm addsrole="alertdialog". Radix setsrole="dialog"on its content and hides the rest of the page from screen readers ([aria-hidden="true"]on everything outside it); passrole="alertdialog"to its content for a destructive confirm. - Name and description:
[aria-labelledby]points to the title,[aria-describedby]to the description; leave the description reference out when there is none, never point it at nothing. - Keyboard: Tab and Shift+Tab stay inside; Escape closes; Enter submits the form. Every way out is also a button: the close button and Cancel.
- Focus: the global ring on every control (base.css); the initial focus per type above; focus returns to the opener on close (WCAG 2.4.3).
- The close button is a 48px icon button named "Close" ("إغلاق", "Fermer") with the plain tooltip in the same words, like every icon button (D-CAI-07).
- Targets: 48 × 48px for the close button and md buttons; 56px in sheets (D-LAY-12).
- Contrast on
surface-raised(tokens/contrast.md):on-surface17.12:1 light and 11.10:1 dark;on-surface-variant9.33:1 and 8.42:1;primary-ink(text buttons) 7.13:1 and 8.41:1;error6.46:1 and 8.45:1. Charts never go in dialogs (V-3). - Reduced motion: no fade or scale; state changes at once (D-SEM-21).
- Headings: the title is an
<h2>, so the page outline stays whole.
RTL and languages
- Logical properties throughout: in Arabic the close button sits at the top left, the title starts at the right, and the action row runs right to left, Cancel first and the main button at the inline end (the left) (D-BCP-30).
- Arabic titles use
headline-smat line height 1.6 and descriptionsbody-mdat 1.75, from the:lang(ar)block of oait.css; never hand-write them (D-TYP-14). - Latin names inside Arabic sit in an isolate:
<bdi lang="en" translate="no">Chrome</bdi>(canonical §14.2). - French runs about 26% longer overall and up to 32% for short labels: titles wrap, buttons never truncate, and a footer whose two labels do not fit side by side stacks them. Write a U+00A0 space before ":" and inside « », and a U+202F space before ";", "!", and "?" (D-TYP-15). Product names stay in Latin and are never translated; in markup they sit in
<bdi lang="en" translate="no">, so they never break across lines (D-BCP-03). - Translate the close button's name and the tooltip with the page: "Close" / "إغلاق" / "Fermer".
Content
- Title: a label in sentence case, no full stop; a question keeps its "?". It names the thing ("Sign out of the library computer?", "Change your home address"), never "Are you sure?" (D-BCP-17, D-BCP-20).
- Description: one or two sentences that say what happens next or what is lost, each with a full stop. 20 words at most per sentence (canonical §12.1).
- Buttons: verb first, from the glossary: "Cancel", "Save", "Done", "Close". A destructive confirm repeats the verb of its question ("Sign out of {device}?" → "Sign out"). Never "OK", "Yes", "Submit", or "Please" (canonical §12.3).
- Form dialogs take the field's question or task as the title and its help as the description; "Save" with the check icon is the main button.
- Examples from the products:
| Type | English | Arabic | French |
|---|---|---|---|
| Basic (Global Jobs) | "Save this job" · "Sign in or create a free account. We’ll save it for you as soon as you’re in." · "Sign in" + "Create account" | — | — |
| Form (Global ID) | "What should we call you?" · "This is the name people see in the directory and in apps. Your official name stays the same." · "Cancel" + "Save" | "بماذا تحب أن ننادِيك؟" · "إلغاء" + "حفظ" | "Comment doit-on vous appeler ?" · "Annuler" + "Enregistrer" |
| Confirm destructive (Global ID) | "Sign out of {device}?" · "Anyone using it will have to sign in again to open your apps." · "Cancel" + "Sign out" | "هل تريد تسجيل الخروج من {device}؟" · "إلغاء" + "تسجيل الخروج" | "Se déconnecter de {device} ?" · "Annuler" + "Se déconnecter" |
| Confirm destructive (Global ID admin) | "Suspend {name}’s Global ID?" · "Suspend Global ID" | "إيقاف Global ID الخاص بـ{name}؟" · "إيقاف Global ID" | "Suspendre le Global ID de {name} ?" · "Suspendre le Global ID" |
Do and don't
- Do ask one question and name the thing: "Remove {name}?". Don't ask "Are you sure?" with "Yes" and "No".
- Do put Cancel first and the main button at the inline end. Don't put two filled buttons in one footer.
- Do keep a dialog to one small form. Don't build a multi-step wizard or a long form in a dialog; make it a page.
- Do open it with
showModal()(or Radix). Don't show a<div>with a fake scrim that leaves the page focusable. - Do return focus to the opener. Don't leave focus on
<body>after closing. - Do confirm success afterwards in the snackbar. Don't open a second dialog to say it worked.
Code
HTML (reference CSS)
Classes from overlay.css (.oa-dialog, .oa-dialog__*, .oa-modal, .oa-sheet__handle) with button.css (.oa-btn, .oa-actions, .oa-icon-btn) and inputs.css (.oa-field). The examples are the snippet's (reference/snippets/overlays.html). Two parts are for documentation only: the .oa-scrim--demo frame, which stands in for the window, and the [open] attribute written in HTML. In a product, leave both out, open the <dialog> with showModal(), and add autofocus to the element that takes focus first.
Basic:
<div class="oa-scrim oa-scrim--demo">
<dialog class="oa-dialog" open aria-labelledby="ov-save-title" aria-describedby="ov-save-desc">
<div class="oa-dialog__header">
<h2 class="oa-dialog__title" id="ov-save-title">Save this job</h2>
<p class="oa-dialog__desc" id="ov-save-desc">Sign in or create a free account. We’ll save it for you as soon as you’re in.</p>
<button class="oa-icon-btn oa-dialog__close" type="button" aria-label="Close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
<div class="oa-dialog__actions oa-actions">
<a class="oa-btn oa-btn--text" href="#sign-in">Sign in</a>
<a class="oa-btn oa-btn--filled" href="#create-account">Create account</a>
</div>
</dialog>
</div>Form:
<div class="oa-scrim oa-scrim--demo">
<dialog class="oa-dialog" open aria-labelledby="ov-name-title" aria-describedby="ov-name-desc">
<div class="oa-dialog__header">
<h2 class="oa-dialog__title" id="ov-name-title">What should we call you?</h2>
<p class="oa-dialog__desc" id="ov-name-desc">This is the name people see in the directory and in apps. Your official name stays the same.</p>
<button class="oa-icon-btn oa-dialog__close" type="button" aria-label="Close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
<form class="oa-dialog__body" id="ov-name-form" novalidate>
<div class="oa-field">
<label class="oa-field__label" for="ov-name-input">Preferred name</label>
<div class="oa-field__control">
<input class="oa-field__input" id="ov-name-input" name="preferred_name" type="text" autocomplete="nickname" value="Rania">
</div>
</div>
</form>
<div class="oa-dialog__actions oa-actions">
<button class="oa-btn oa-btn--text" type="button">Cancel</button>
<button class="oa-btn oa-btn--filled" type="submit" form="ov-name-form">
<span class="oa-icon oa-btn__icon" aria-hidden="true" translate="no">check</span>
<span class="oa-btn__label">Save</span>
</button>
</div>
</dialog>
</div>Confirm destructive (the [data-demo-focus] attribute shows where focus starts; never ship it):
<div class="oa-scrim oa-scrim--demo">
<dialog class="oa-dialog" role="alertdialog" open aria-labelledby="ov-signout-title" aria-describedby="ov-signout-desc">
<div class="oa-dialog__header">
<h2 class="oa-dialog__title" id="ov-signout-title">Sign out of the library computer?</h2>
<p class="oa-dialog__desc" id="ov-signout-desc">Anyone using it will have to sign in again to open your apps.</p>
<button class="oa-icon-btn oa-dialog__close" type="button" aria-label="Close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
<div class="oa-dialog__actions oa-actions">
<button class="oa-btn oa-btn--text" type="button" data-demo-focus>Cancel</button>
<button class="oa-btn oa-btn--danger" type="button">Sign out</button>
</div>
</dialog>
</div>Long form with a sticky action row:
<div class="oa-scrim oa-scrim--demo">
<dialog class="oa-dialog" open aria-labelledby="ov-report-title" aria-describedby="ov-report-desc">
<div class="oa-dialog__header">
<h2 class="oa-dialog__title" id="ov-report-title">Report this job</h2>
<p class="oa-dialog__desc" id="ov-report-desc">Tell our team what is wrong. Reports are private: the employer never sees who sent them.</p>
<button class="oa-icon-btn oa-dialog__close" type="button" aria-label="Close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
<form class="oa-dialog__body" id="ov-report-form" novalidate>
<fieldset class="oa-fieldset">
<legend class="oa-fieldset__legend">What is wrong?</legend>
<label class="oa-check">
<input class="oa-check__input" type="radio" name="reason" value="scam">
<span class="oa-check__label">Looks like a scam or fake job</span>
</label>
<label class="oa-check">
<input class="oa-check__input" type="radio" name="reason" value="money">
<span class="oa-check__label">Asks for money, fees, or deposits</span>
</label>
<label class="oa-check">
<input class="oa-check__input" type="radio" name="reason" value="filled">
<span class="oa-check__label">The job is already filled</span>
</label>
<label class="oa-check">
<input class="oa-check__input" type="radio" name="reason" value="other">
<span class="oa-check__label">Something else</span>
</label>
</fieldset>
<div class="oa-field">
<label class="oa-field__label" for="ov-report-details">Details <span class="oa-field__optional">(optional)</span></label>
<div class="oa-field__control">
<textarea class="oa-field__input" id="ov-report-details" name="details" rows="3"></textarea>
</div>
</div>
</form>
<div class="oa-dialog__actions oa-dialog__actions--sticky oa-actions">
<button class="oa-btn oa-btn--text" type="button">Cancel</button>
<button class="oa-btn oa-btn--filled" type="submit" form="ov-report-form">
<span class="oa-icon oa-btn__icon" aria-hidden="true" translate="no">check</span>
<span class="oa-btn__label">Send report</span>
</button>
</div>
</dialog>
</div>Responsive modal, a bottom sheet below 768px and a dialog from 768px:
<div class="oa-scrim oa-scrim--demo">
<dialog class="oa-modal" open aria-labelledby="ov-address-title" aria-describedby="ov-address-desc">
<span class="oa-sheet__handle" aria-hidden="true"></span>
<div class="oa-dialog__header">
<h2 class="oa-dialog__title" id="ov-address-title">Change your home address</h2>
<p class="oa-dialog__desc" id="ov-address-desc">Where you live during term. Official letters from the Registrar are posted here.</p>
<button class="oa-icon-btn oa-dialog__close" type="button" aria-label="Close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
<form class="oa-dialog__body" id="ov-address-form" novalidate>
<div class="oa-field">
<label class="oa-field__label" for="ov-address-input">Home address</label>
<div class="oa-field__control">
<input class="oa-field__input" id="ov-address-input" name="address" type="text" autocomplete="street-address" value="Bliss Street, Ras Beirut">
</div>
</div>
</form>
<div class="oa-dialog__actions oa-actions oa-actions--modal">
<button class="oa-btn oa-btn--text" type="button">Cancel</button>
<button class="oa-btn oa-btn--filled" type="submit" form="ov-address-form">
<span class="oa-icon oa-btn__icon" aria-hidden="true" translate="no">check</span>
<span class="oa-btn__label">Save</span>
</button>
</div>
</dialog>
</div>Arabic, on a page with <html lang="ar" dir="rtl">:
<div class="oa-scrim oa-scrim--demo">
<dialog class="oa-dialog" role="alertdialog" open aria-labelledby="ov-signout-ar-title" aria-describedby="ov-signout-ar-desc">
<div class="oa-dialog__header">
<h2 class="oa-dialog__title" id="ov-signout-ar-title">هل تريد تسجيل الخروج من <bdi lang="en" translate="no">Chrome</bdi> على ويندوز؟</h2>
<p class="oa-dialog__desc" id="ov-signout-ar-desc">على أي شخص يستخدمه أن يسجّل الدخول من جديد لفتح تطبيقاتك.</p>
<button class="oa-icon-btn oa-dialog__close" type="button" aria-label="إغلاق">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
<div class="oa-dialog__actions oa-actions">
<button class="oa-btn oa-btn--text" type="button">إلغاء</button>
<button class="oa-btn oa-btn--danger" type="button">تسجيل الخروج</button>
</div>
</dialog>
</div>Tailwind CSS v4
The same recipe for a Radix Dialog.Overlay and Dialog.Content (siblings), or any element version:
<!-- Dialog.Overlay -->
<div class="fixed inset-0 z-50 bg-scrim transition-opacity duration-short-3 ease-standard starting:opacity-0"></div>
<!-- Dialog.Content -->
<div class="fixed inset-0 z-50 m-auto flex h-fit max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-dialog flex-col gap-stack-loose overflow-auto overscroll-contain rounded-sheet border border-transparent bg-surface-raised p-card-medium text-on-surface shadow-elevation-3 transition-[opacity,scale] duration-short-3 ease-emphasized starting:scale-95 starting:opacity-0">
<div class="flex flex-col gap-stack-tight pe-10">
<h2 class="text-headline-sm text-on-surface">Sign out of the library computer?</h2>
<p class="text-body-md text-on-surface-variant">Anyone using it will have to sign in again to open your apps.</p>
<!-- the close icon button: absolute top-2 end-2 on the icon-button recipe -->
</div>
<form class="-m-2 flex min-h-0 flex-1 flex-col gap-fields overflow-y-auto overscroll-contain p-2"><!-- fields --></form>
<div class="flex flex-none flex-wrap items-center justify-end gap-2"><!-- Cancel (text, md) then the main button --></div>
</div>- Sticky action row: add
-mx-card-medium -mt-2 border-t border-outline-variant px-card-medium pt-4to the row. - Responsive modal: start from the bottom-sheet recipe (bottom-sheet.md) and add
md:inset-0 md:m-auto md:h-fit md:w-[calc(100%-2rem)] md:max-h-[calc(100dvh-2rem)] md:rounded-sheet md:border-b md:p-card-medium md:transition-[opacity,scale] md:duration-short-3 md:starting:translate-y-0 md:starting:scale-95 md:starting:opacity-0, andmd:hiddenon the handle. - Exits: Radix keeps closed content mounted only while a CSS animation runs on it (keyframes, never a transition), so this recipe enters with motion and closes at once, which is also what reduced motion does. The tokens ship no exit keyframes in 1.0.0: a Radix product that wants the canonical exit adds an animation on
[data-state="closed"]that fades to 0 over--duration-short-3with--ease-emphasized-accelerate, and one that exits at once is allowed; an--animate-fade-outtoken is requested for 1.1 (CHANGELOG). The native<dialog>of overlay.css needs none. - shadcn/ui: edit Dialog to
rounded-sheet bg-surface-raised shadow-elevation-3and the overlay tobg-scrim(canonical §2.12).
React
Global ID's modal kit (src/components/ui/) is the family's React reference, all on Radix Dialog: Dialog and BottomSheet share one props type (ModalProps), and three wrappers pick the container with useIsWide() (768px): FormModal, ConfirmModal, and InfoModal.
Dialog and BottomSheet:
| Prop | Type | Default | Description |
|---|---|---|---|
open |
boolean |
required | Keep the modal mounted and flip this, so closing hands focus back to the opener. |
onOpenChange |
(open: boolean) => void |
required | Called with false on Escape, a scrim press, Close, and Cancel. |
title |
string |
required | Names the dialog; a dialog without a name is announced as nothing. |
description |
string |
none | One or two sentences; omitted means no [aria-describedby]. |
children |
ReactNode |
none | The body: one form or a few sentences. |
actions |
ReactNode |
none | The footer, with the quiet button first and the main one last. |
closeLabel |
string |
required | New in 1.0.0 (ID-2.06): the close button's name and tooltip in the page language ("Close"). |
role |
'dialog' | 'alertdialog' |
'dialog' |
New in 1.0.0: ConfirmModal passes 'alertdialog'. |
The wrappers draw the footer themselves: from 768px both buttons are md and Cancel is a text button; below, both are lg with flex-1 and Cancel is outlined.
| Wrapper | Props | Main button |
|---|---|---|
FormModal |
open, onClose, title, description, formId (the <form> in children), cancelLabel, submitLabel, submitIcon (default 'check'), busy, children |
the submit of formId, with its icon |
ConfirmModal |
open, onClose, title, body, cancelLabel, confirmLabel, busy, onConfirm |
danger, the verb of the title |
InfoModal |
open, onClose, title, body, closeLabel (its one button: "Close", "Done"), children |
filled, the only button |
busy (default false) turns the main button busy: today the [disabled] attribute, from 1.0.0 [aria-busy="true"] and [aria-disabled="true"] with a progress label and a spinner (D-CAI-06).
<ConfirmModal
open={confirming}
title={t('security.sessions.confirmTitle', { device })}
body={t('security.sessions.confirmBody')}
cancelLabel={t('security.cancel')}
confirmLabel={t('security.sessions.signOut')}
busy={signingOut}
onConfirm={signOut}
onClose={() => setConfirming(false)}
/>