Components
Alert Dialog
Alert dialogs interrupt the user to confirm a critical or destructive action. Use for actions that cannot be undone.
Stable
GitHubAnatomy
Anatomy
import {AlertDialog} from '@staffbase/design';
<AlertDialog.Root>
<AlertDialog.Trigger />
<AlertDialog.Popup>
<AlertDialog.Icon />
<AlertDialog.Title />
<AlertDialog.Description />
<AlertDialog.Action />
<AlertDialog.Cancel />
</AlertDialog.Popup>
</AlertDialog.Root>API reference
Root
Inherits props fromBase UI Alert Dialog Root
Trigger
Inherits props fromBase UI Alert Dialog Trigger
| Name | Type | Description |
|---|---|---|
children | ReactNode | Opens the dialog when activated. Must be a button element. |
Popup
Inherits props fromBase UI Alert Dialog Popup
| Name | Type | Description |
|---|---|---|
container | HTMLElementRefObject<HTMLElement> | Use this instead of z-index to specify another parent element to render the dialog portal into. Default is the document body. |
Icon
| Name | Type | Description |
|---|---|---|
children | ReactNode | A wrapper to style the icon to render in the dialog. |
Title
| Name | Type | Description |
|---|---|---|
children | ReactNode | A heading that labels the dialog. |
Description
| Name | Type | Description |
|---|---|---|
children | ReactNode | Additional information about the action requested by the dialog. |
Action
| Name | Type | Description |
|---|---|---|
color | "primary""critical" | Optional. The color variant of the action button (defaults to "primary"). Use "critical" for destructive actions. |
children | ReactNode | The label for the action button. |
Cancel
| Name | Type | Description |
|---|---|---|
children | ReactNode | The label for the cancel button. Closes the dialog when activated. |
When to use
When not to use
How to use
Structure
Delete this item?
This action cannot be undone. The item will be permanently removed.
Icon
Buttons
Send email to 1,235 people?
All recipients will be notified by email immediately.
Delete space?
This action cannot be undone. All content in this space will be permanently removed.
Behavior
Accessibility
Content & UX copy
Do
Delete space?
This action cannot be undone. All content in this space will be permanently removed.
Title as a verb + noun question; action button repeats the verb.
Don't
Are you sure?!
Do you really want to do this?
Vague question, exclamation points, and Yes/No buttons.