Skip to main content

Common Examples

To use the Dialog, pass the required title and content props. Open it with a Carto Button through trigger, or control it with isOpen and onOpenChange.

Actions

Pass primaryAction 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

Omit trigger 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 beyond 90vh scrolls inside the body while the header and footer remain visible.

Internationalization

Localize title, 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 title labels the modal through aria-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 isKeyboardDismissDisabled only when the flow requires blocking Escape.
Last modified on August 28, 2026