Skip to content
uiify

Alert modal

Dialog that asks the user to confirm or cancel an action.

Browsers
Chrome 123+Firefox 121+Safari 17.5+
Tier
0
Bundle compressed
555 B
Forced layout budget
0 ms
Axe budget
0
SSR compatible
Yes
Built on
elements/dialog
Published contract
Test harness

Playground

Alert Modal

Closed

Delete item?

This action cannot be undone.

API

AlertModal

PropTypeDefaultDescription
id*string—Unique id for the alertdialog element, targeted by the trigger, cancel and action buttons.
trigger*ReactNode—Content of the button that opens the dialog.
title*ReactNode—Heading rendered inside the dialog and used as its accessible name.
descriptionReactNode—Supporting text rendered under the title and referenced by aria-describedby.
childrenReactNode—Body content placed between the description and the two buttons.
actionLabelReactNode"Confirm"Content of the confirming button, which closes with the value "confirm".
cancelLabelReactNode"Cancel"Content of the dismissing button, which closes with the value "cancel".
classNamestring—Class applied to the dialog element.

AlertModalTrigger

PropTypeDefaultDescription
target*string—Id of the AlertModalContent this button opens; resolved by the browser at click time.
childrenReactNode—Content of the trigger button.
asTAs & NativeButtonAs<TAs>"button"A component that forwards props and ref to a native button; other tags are rejected, because invoker commands need a real button.

AlertModalContent

PropTypeDefaultDescription
id*string—Unique id supplied by the consumer; referenced by the other parts.
childrenReactNode—Content of the dialog, which is rendered with role="alertdialog".

AlertModalAction

PropTypeDefaultDescription
target*string—Id of the AlertModalContent this button closes to confirm.
childrenReactNode—Content of the confirming button.
asTAs & NativeButtonAs<TAs>"button"A component that forwards props and ref to a native button; other tags are rejected, because invoker commands need a real button.

AlertModalCancel

PropTypeDefaultDescription
target*string—Id of the AlertModalContent this button closes to dismiss.
childrenReactNode—Content of the dismissing button.
asTAs & NativeButtonAs<TAs>"button"A component that forwards props and ref to a native button; other tags are rejected, because invoker commands need a real button.

Keyboard

KeyAction
TabMove focus to/from the control
Enter / SpaceActivate when focused (button-like controls)

Accessibility

Uses semantic HTML where possible. Inspect rendered markup in the playground — ARIA is added only when native elements are insufficient.

Styling hooks

data-disabled