AlertDialogAction does not close the alert. Control open, and close it when the action ends.
delete-file-dialog.tsx
AlertDialog
| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From Base UIAlertDialog.RootBase UI docs | |||||||||||||||||||||||||||||||||
| on | — | Event handler called when the alert dialog is opened or closed. | |||||||||||||||||||||||||||||||
| actions | RefObject<DialogRootActions | null> | — | A ref to imperative actions. - unmount: Ends the closing phase of the alert dialog after an externally controlled closing animation finishes. Call preventUnmountOnClose in onOpenChange first, otherwise the alert dialog completes closing on its own. Whether it leaves the DOM is decided by keepMounted on the portal. - close: Closes the alert dialog imperatively when called. | ||||||||||||||||||||||||||||||
| handle | AlertDialogHandle<Payload> | — | A handle to associate the alert dialog with a trigger. If specified, allows external triggers to control the alert dialog's open state. Can be created with the AlertDialog.createHandle method. | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||
AlertDialogTrigger
<button>| Prop | Type | Default | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||
From Base UIDialog.TriggerBase UI docs | |||||||||||||||||||||
| payload | Payload | — | A payload to pass to the dialog when it is opened. | ||||||||||||||||||
| id | string | — | ID of the trigger. In addition to being forwarded to the rendered element, it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot triggerId prop). | ||||||||||||||||||
| handle | AlertDialogHandle<Payload> | — | A handle to associate the trigger with an alert dialog. Can be created with the AlertDialog.createHandle method. | ||||||||||||||||||
| |||||||||||||||||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | ||||||||||||||||||
AlertDialogPortal
<div>| Prop | Type | Default | Description |
|---|---|---|---|
From Base UIDialog.PortalBase UI docs | |||
| keep | boolean | false | Whether to keep the portal mounted in the DOM while the popup is hidden. |
| container | — | A parent element to render the portal element into. | |
| class | — | CSS class applied to the element, or a function that returns a class based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogOverlay
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
From Base UIDialog.BackdropBase UI docs | |||
| force | boolean | false | Whether the backdrop is forced to render even when nested. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogContent
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| size | "default""sm" | "default" | |
| class | string | — | |
| portal | — | Other Base UI props of the inner parts. A className here adds to the component classes. | |
| backdrop | AlertDialogOverlayProps | — | |
| viewport | — | ||
From Base UIDialog.PopupBase UI docs | |||
| initial | — | Determines the element to focus when the dialog is opened. By default, focus moves to the first tabbable element inside the popup, except when the dialog is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard. - false: Do not move focus. - true: Move focus based on the default behavior (first tabbable element or popup). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, null to fall back to the default behavior, or false/undefined to do nothing. | |
| final | — | Determines the element to focus when the dialog is closed. - false: Do not move focus. - true: Move focus based on the default behavior (trigger or previously focused element). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, null to fall back to the default behavior, or false/undefined to do nothing. | |
| container | — | A parent element to render the portal element into. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogHeader
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogMedia
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| tone | "destructive""info""neutral""success""warning" | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogTitle
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogDescription
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogFooter
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogCancel
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| rounded | "default""full" | — | |
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | — | |
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | "outline" | |
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AlertDialogAction
<button>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| glass | "clear""dark""light" | — | |||||
| rounded | "default""full" | — | |||||
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | — | |||||
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | — | |||||
| class | string | — | |||||
| busy | boolean | — | The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading. | ||||
| spinner | "center""start" | — | center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label. | ||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether the button should be focusable when disabled. | ||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |||||
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |||||
| |||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | ||||
| Esc | Closes the alert dialog. Treat it as Cancel. |
|---|---|
| Tab | Moves the focus to the next button. The focus stays in the alert dialog. |
| ShiftTab | Moves the focus to the previous button. |
| Enter | Presses the focused button. |
- DialogPick Dialog for a task, a form, or a detail view that needs more than a yes or no answer.
- ButtonA button for an action on the page, such as Save or Delete. It has 9 looks and 5 sizes, and a spinner that keeps its width while the action runs.
- ToastPick Toast for a note that needs no answer and closes on its own.
- AlertPick Alert for a message that stays in the page and needs no answer.
Built with
Installs with Alert Dialog
- Components
- Button







