datui
Color scheme

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" with aria-modal="true", aria-labelledby on the title and aria-describedby on the description.
  • Focus moves to the first cancel action (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.

PropTypeDefaultDescription
actionsAlertActionItem[][]
actionsAlign"center" | "start" | "end"end
actionsLayout"horizontal" | "vertical"horizontal
classNamestring—
closeLabelstringClose
defaultOpenbooleantrue
descriptionReactNode—
dismissButtonMode"none" | "inside"insideClose (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)—
openboolean—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.
restoreFocusRestoreFocustrue
titleReactNode—