Dialog

Open in v0

Last updated: September 20, 2026

Animated modal dialog with title, description, close button, and focus trap. Includes an AlertDialog variant that requires explicit user action.

Installation

npx smoothui-cli add dialog

Features

Controlled modal with title, description, footer slots, focus trap, and spring entrance. Two variants: a dismissible dialog and an alert dialog that requires an explicit action.

Variants

Dialog

Standard modal — Escape and backdrop click dismiss it. Includes a close button and returns focus to the trigger when closed.

Alert Dialog

Destructive or irreversible actions. Escape is ignored; the user must choose Cancel or Continue. Use for delete confirmations and similar flows.

Accessibility

Keyboard Interactions

KeyDescription
EscapeCloses the dialog (Dialog only — AlertDialog ignores Escape)
TabCycles focus through focusable elements within the dialog (focus is trapped)
Shift + TabCycles focus backward through focusable elements within the dialog

ARIA Attributes

AttributeElementPurpose
role="dialog"Dialog contentIdentifies the element as a dialog
role="alertdialog"AlertDialog contentIdentifies the element as an alert dialog requiring user action
aria-labelledbyDialog/AlertDialog contentReferences the title for an accessible name
aria-describedbyDialog/AlertDialog contentReferences the description
aria-modal="true"Dialog/AlertDialog contentIndicates content behind is inert

Screen Reader

  • Focus moves to the dialog content when opened
  • Focus is trapped within the dialog while open
  • Focus returns to the previously focused element when the dialog closes
  • The title is announced via aria-labelledby

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, all scale, fade, and zoom animations are disabled instantly.

Props

DialogProps

AlertDialogProps

Created by

Improved by

Edu Calvo's avatar

Powered by

motion.dev

© 2026 SmoothUI. Built by Eduardo Calvo.