Dialog
A wrapper around React Aria’s DialogTrigger, Modal, and Dialog components.
Focus is trapped inside the dialog while it is open and returns to the trigger on close.
Add via CLI
Section titled “Add via CLI”npx @a2ra/cli add dialogAlert dialog
Section titled “Alert dialog”Example JSON
Section titled “Example JSON”{ "type": "Dialog", "props": { "triggerLabel": "Delete account", "title": "Delete account", "description": "This will permanently delete your account and all data.", "role": "alertdialog", "isDismissable": false }, "children": [ { "type": "Flex", "props": { "gap": "sm", "justify": "end" }, "children": [ { "type": "Button", "props": { "variant": "secondary" }, "children": "Cancel" }, { "type": "Button", "props": { "variant": "danger" }, "children": "Delete" } ] } ]}| Prop | Type | Description |
|---|---|---|
triggerLabel | string | Label for the button that opens the dialog |
title | string | Dialog heading |
description | string | Supporting text shown below the title |
role | dialog defaultalertdialog | ARIA role (alertdialog prevents dismissal by clicking outside) |
isDismissable | true defaultfalse | Allow closing by clicking the backdrop |
isKeyboardDismissDisabled | truefalse default | Prevent Escape from closing |
isOpen | boolean | Controlled open state |
defaultOpen | truefalse default | Open on mount |
children | node[] | Content rendered inside the dialog body |
role: "alertdialog"tells screen readers this is a message requiring attention; it also disables backdrop-click dismissal regardless ofisDismissable.- Focus is trapped inside the dialog and returns to the trigger on close.
Escapecloses the dialog by default unlessisKeyboardDismissDisabledis true.