Modal

Componente de modal acessível com suporte a múltiplos tamanhos, backdrop blur e animações.

Basic Modal

import { useState } from 'react'
import { Modal, Button } from '@mt/design-system'
function Example() {
const [isOpen, setIsOpen] = useState(false)
return (
<>
<Button onClick={() => setIsOpen(true)}>
Abrir Modal
</Button>
<Modal
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Modal Title"
description="This is a modal description"
>
<p className="text-mt-text-muted">
Modal content goes here.
</p>
</Modal>
</>
)
}

Small Modal

<Modal
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Small Modal"
size="sm"
>
<p className="text-mt-text-muted">
This is a small modal.
</p>
</Modal>

Large Modal

<Modal
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Large Modal"
size="lg"
>
<p className="text-mt-text-muted">
This is a large modal.
</p>
</Modal>

Props

PropTypeDefaultDescription
isOpenboolean-Controls whether the modal is open or closed
onClose() => void-Callback function when modal is closed
titlestring-Modal title
descriptionstring-Modal description/subtitle
size'sm' | 'md' | 'lg' | 'xl''md'Size of the modal
showCloseButtonbooleantrueShows the close button in the header
childrenReactNode-Modal content

Features

  • Fecha ao pressionar ESC
  • Fecha ao clicar no backdrop
  • Bloqueia scroll do body quando aberto
  • Animação de fade in e scale
  • Backdrop com blur
  • Acessível (ARIA labels)