- Implementation
- Dialog Props
Common Examples
To use theDialog, pass the required title and content props. Open it with a Carto Button through trigger, or control it with isOpen and onOpenChange.Actions
PassprimaryAction for the confirm action and secondaryAction for dismissal. The dialog fixes both buttons at medium size and fixes the secondary action to the secondary variant.Use variant: "danger" on primaryAction for destructive confirmation.Footerless
Omit both actions for a footerless dialog. The header close button remains available.Controlled state
Omittrigger and pass isOpen with onOpenChange when an event or another component opens the dialog. Footer actions request closure after their own onPress handlers run. For asynchronous flows that must remain open, treat onOpenChange as a request and retain control of isOpen.Scrolling body
Content beyond90vh scrolls inside the body while the header and footer remain visible.Internationalization
Localizetitle, content, and action labels before passing them to Dialog.The built-in header close button currently uses the English accessible
label
"Close".React Accessibility
- The required
titlelabels the modal througharia-labelledby. - React Aria supplies focus trapping and restoration, scroll lock,
aria-modal, Escape dismissal, and outside-interaction dismissal. - The body is always keyboard-focusable so keyboard users can scroll plain text.
- Set
isKeyboardDismissDisabledonly when the flow requires blocking Escape.