Skip to main content

Overview

Edit profile
Update your display name and bio.
Ahmad Dani
🗑
Delete account?
All your data will be permanently deleted.
Modal renders a centered overlay panel over a dimmed backdrop. Use it for confirmations, form flows, detail views, and any interaction that requires the user’s full attention.
For simple yes/no confirmations, consider a compact AlertDialog. Use Drawer or Sheet for side-panel interactions that don’t block the full screen.

Installation


Usage


Variants

Default Modal

Standard dialog for forms or informational content.
Edit profile
Update your display name and bio.
Ahmad Dani

Warning Modal

Unpublish page?
This page will no longer be visible to users.

Destructive Modal

Delete account?
All your data will be permanently deleted. This cannot be undone.
Always require a second confirmation step before executing destructive actions in a Modal.

API Reference

boolean
Controls the open state.
(open: boolean) => void
Callback fired when the open state changes.
boolean
default:"false"
Uncontrolled default open state.

ModalContent

string
default:"md"
Dialog width. Values: sm · md · lg · xl · full
ReactNode
Icon shown in the header area alongside the title.
string
default:"default"
Icon container background. Values: default · warning · destructive
string
Additional Tailwind classes for custom overrides.

ModalFooter

string
default:"end"
Button alignment inside the footer. Values: start · end · between

Accessibility

  • Modal uses role="dialog" with aria-modal="true"
  • Focus is trapped inside the modal while open
  • Pressing Escape closes the modal
  • Focus returns to the trigger element when the modal closes
  • ModalTitle is linked via aria-labelledby
  • ModalDescription is linked via aria-describedby

Do’s & Don’ts

Do

  • Use Modal for actions that require the user’s complete attention
  • Keep modals focused on a single task
  • Always provide a clear Cancel/Close action
  • Use destructive iconVariant for irreversible actions

Don't

  • Don’t use Modal for non-critical information — use Toast or Alert
  • Don’t nest modals inside other modals
  • Don’t make modals too large — keep content scannable
  • Don’t auto-close a modal after a destructive action without confirmation