Component

Modal

A focused dialog surface with animation, close controls, size options, and contextual variants.

Examples

Live previews paired with copyable source.

Basic Modal

Open and close a dialog with a title, description, and action row.

tsx
const modal = useModal()

<Button onClick={modal.open}>Open Modal</Button>
<Modal
  isOpen={modal.isOpen}
  onClose={modal.close}
  title="Project settings"
  description="Review changes before saving."
>
  <Button onClick={modal.close}>Save</Button>
</Modal>

Sizes

Pick a width that matches the complexity of the content.

tsx
<Modal isOpen={isOpen} onClose={close} title="Small modal" size="sm" />
<Modal isOpen={isOpen} onClose={close} title="Large modal" size="lg" />

API Reference

Props available on the component.

PropTypeDefaultDescription
isOpenbooleanrequiredControls whether the dialog is visible.
onClose() => voidrequiredCalled when the modal requests to close.
titlestringundefinedOptional dialog heading.
descriptionstringundefinedOptional supporting text below the title.
size'sm' | 'md' | 'lg' | 'xl' | 'full''md'Controls the dialog width.
variant'default' | 'destructive' | 'success''default'Applies contextual surface and text colors.
closeOnOutsideClickbooleanfalseAllows clicking the backdrop to close the modal.
showClosebooleantrueShows or hides the close icon button.