useXDSImperativeDialog@xds/core · Dialog
Preview coming soon
Usage
Dialog displays a modal overlay that blocks interaction with the page until the user responds. Use it for delete confirmations, edit forms, terms acceptance, or any decision that should not be skipped. For cases where you want to show a dialog without managing open state, use the `useXDSImperativeDialog` hook — call `dialog.show(content)` and render `dialog.element` in your tree.Best practices
| Guidance | Practices |
|---|---|
| Do | Choose the right purpose: info for dismissable content, form to prevent accidental backdrop dismissal, required when the user must respond. |
| Do | Include a clear title in the header so users immediately understand what the dialog is asking. |
| Do | Use purpose="form" for dialogs with inputs so the user can't accidentally lose data by clicking the backdrop. |
| Do | Keep dialogs focused on a single task — if the content grows beyond what fits, consider a full page instead. |
| Don't | Use a dialog for simple messages that could be shown inline or as a toast notification. |
| Don't | Nest dialogs inside other dialogs — restructure the flow into steps within a single dialog instead. |
| Don't | Use the fullscreen variant for simple confirmations — it is meant for complex content like editors or long forms. |
Anatomy
| Element | Description | |
|---|---|---|
| Header | required | Title, optional subtitle, and close button. The title receives focus on open for accessibility. |
| Body | required | The main content area — text, forms, lists, or any layout. |
| Footer | Action buttons like Save/Cancel or Accept/Decline, aligned to the end. | |
| Backdrop | required | Semi-transparent overlay behind the dialog that blocks page interaction. |
Import
tsimport {useXDSImperativeDialog} from '@xds/core/Dialog'
Props
| Prop | Type | Description |
|---|---|---|
show | (content: ReactNode, options?: DialogOptions) => void | Show the dialog with the given content. Options are the same as XDSDialog props minus isOpen/onOpenChange/children. |
hide | () => void | Hide the dialog. |
isOpen | boolean | Whether the dialog is currently open. |
element | ReactNode | The dialog element — render this in your JSX tree. |