Overlays
Alert
Blocking confirmation dialog with a title, description and a row of actions.
import { Alert } from "datui";Examples
Confirm
Mount it to show it; onClosed fires after it has closed.
Vertical actions
Accessibility
- Renders
role="alertdialog"witharia-modal="true",aria-labelledbyon the title andaria-describedbyon the description. - Focus moves to the first
cancelaction (else the first action), is trapped, and returns to the previously focused element on close. - Escape and an overlay click close it; action clicks close it unless
autoCloseDisabled. - The close (X) button is shown on regular width only and is labelled by
closeLabel.
API
Alert
Blocking confirmation dialog with a title, description and a row of actions.
| Prop | Type | Default | Description |
|---|---|---|---|
| actions | AlertActionItem[] | [] | |
| actionsAlign | "center" | "start" | "end" | end | |
| actionsLayout | "horizontal" | "vertical" | horizontal | |
| className | string | — | |
| closeLabel | string | Close | |
| defaultOpen | boolean | true | |
| description | ReactNode | — | |
| dismissButtonMode | "none" | "inside" | inside | Close (XIcon) button; shown on regular width only. |
| onClose | ((reason: AlertCloseReason) => void) | — | |
| onClosed | (() => void) | — | Called after the exit animation, once the dialog has unmounted. |
| onOpenChange | ((open: boolean) => void) | — | |
| open | boolean | — | Controlled visibility. Mount the Alert to show it, or drive it with `open`. |
| renderAction | ((props: AlertActionRenderProps) => ReactNode) | — | Replace the default action button. Spread `onClick` on your element. |
| restoreFocus | RestoreFocus | true | |
| title | ReactNode | — |