Modal

A general-purpose modal. Compose ModalTrigger + ModalContent (with ModalHeader, ModalTitle, ModalDescription, ModalFooter). It closes on Esc and backdrop click and shows a close button by default.

For a confirmation prompt that must not dismiss on outside click, use Alert Dialog instead. For a fully controlled, trigger-less panel see Dialog.

Props

PropTypeDefaultDescription
openbooleanControlled open state. Omit for uncontrolled.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => voidFired when open state changes.

ModalContent

PropTypeDefaultDescription
showCloseButtonbooleantrueShow the corner close button.

ModalTrigger and ModalClose accept asChild to render your own element.