useXDSImperativeAlertDialog@xds/core · AlertDialog

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

GuidancePractices
DoMake the action button label specific — "Delete project" is better than "OK" or "Confirm".
DoDescribe what will happen in the description so the user knows the consequences before confirming.
Don'tUse AlertDialog for non-destructive actions — use a standard Dialog instead.

Import

ts
import {useXDSImperativeAlertDialog} from '@xds/core/AlertDialog'

Props

PropTypeDescription
show
(options: AlertDialogOptions) => voidShow the alert dialog with the given options. Options are the same as XDSAlertDialog props minus isOpen/onOpenChange.
hide
() => voidHide the alert dialog.
isOpen
booleanWhether the dialog is currently open.
element
ReactNodeThe dialog element — render this in your JSX tree.