Components · Overlays
Alert Dialog
Confirmation dialog that requires an explicit user action before proceeding.
import { AlertDialog } from '@nexub/react';Examples
Default
Type to confirm
Deleting a workspace asks for its name first.
Ask for a reason
usePrompt replaces window.prompt, with limits and a busy state.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| AlertDialog.Root | compound | — | Root provider component that manages open state. |
| AlertDialog.Trigger | compound | — | Element that opens the dialog on interaction. |
| AlertDialog.Portal | compound | — | Portals the overlay and content into the document body. |
| AlertDialog.Overlay | compound | — | Dimmed backdrop rendered behind the content. |
| AlertDialog.Content | compound | — | The dialog panel containing title, description, and actions. |
| AlertDialog.Title | compound | — | Accessible title announced to screen readers. |
| AlertDialog.Description | compound | — | Supporting description text for the dialog. |
| AlertDialog.Action | compound | — | Confirms the destructive or affirmative action and closes the dialog. |
| AlertDialog.Cancel | compound | — | Cancels the action and closes the dialog. |
| AlertDialog.Confirm text | string | — | Type-to-confirm (5.6): the Action stays disabled until this text is typed. For irreversible actions on named resources. |
| AlertDialog.Prompt | component | — | 11.2: asks for one line of text in place of window.prompt: title, label, required (default true), minLength, maxLength, validate, multiline, tone, and onSubmit (busy while its promise runs; a rejection shows its message and keeps the dialog open). |
| usePrompt() | [prompt, element] | — | 11.2: render element once; await prompt(options) resolves to the trimmed answer, or null when cancelled. |
Design tokens
Alert Dialog reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Alert Dialog below it, and leave the roles other components share alone. See the three token tiers.
Dialog and AlertDialog.
| Token | Aliases | Notes |
|---|---|---|
| --dialog-bg | --color-surface-elevated | — |
| --dialog-fg | --color-on-surface | — |
| --dialog-radius | --shape-overlay | — |
/* One area of your app */
.checkout {
--dialog-bg: var(--color-secondary);
}On iOS & Android: Dialog
import { Dialog } from '@nexub/react-native';
<Dialog dismissible={false} open={open} onOpenChange={setOpen} title="Sign out?" actions={<Button onPress={signOut}>Sign out</Button>} />Web vs mobile
Same tokens and prop names. Where the platforms differ:
| Web | iOS & Android | |
|---|---|---|
| Dismiss | AlertDialog never closes on outside click. | dismissible={false} gives the same. |
Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.
On device

iPhone (iOS simulator)

Pixel (Android emulator)
Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.
Dialog props
| Prop | Type | Default | Description |
|---|---|---|---|
| openrequired | boolean | — | — |
| onOpenChangerequired | (open: boolean) => void | — | — |
| titlerequired | string | — | — |
| description | string | — | — |
| children | React.ReactNode | — | Extra content between the description and the actions. |
| actionsrequired | React.ReactNode | — | 1–2 Buttons; put the confirming action last. |
| dismissible | boolean | true | Tapping the scrim or Android back closes it. |