useXDSImperativeAlertDialog@xds/core · AlertDialog
Preview coming soon
Usage
AlertDialog asks the user to confirm a destructive or irreversible action before it happens. Use it for things like deleting content, revoking access, or discarding unsaved changes. For cases where you want to show an alert without managing open state, use the `useXDSImperativeAlertDialog` hook — call `alert.show(options)` and render `alert.element` in your tree.Best practices
| Guidance | Practices |
|---|---|
| Do | Make the action button label specific — "Delete project" is better than "OK" or "Confirm". |
| Do | Describe what will happen in the description so the user knows the consequences before confirming. |
| Don't | Use AlertDialog for non-destructive actions — use a standard Dialog instead. |
Import
tsimport {useXDSImperativeAlertDialog} from '@xds/core/AlertDialog'
Props
| Prop | Type | Description |
|---|---|---|
show | (options: AlertDialogOptions) => void | Show the alert dialog with the given options. Options are the same as XDSAlertDialog props minus isOpen/onOpenChange. |
hide | () => void | Hide the alert dialog. |
isOpen | boolean | Whether the dialog is currently open. |
element | ReactNode | The dialog element — render this in your JSX tree. |