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><ModalisOpen={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
<ModalisOpen={isOpen}onClose={() => setIsOpen(false)}title="Small Modal"size="sm"><p className="text-mt-text-muted">This is a small modal.</p></Modal>
Large Modal
<ModalisOpen={isOpen}onClose={() => setIsOpen(false)}title="Large Modal"size="lg"><p className="text-mt-text-muted">This is a large modal.</p></Modal>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
isOpen | boolean | - | Controls whether the modal is open or closed |
onClose | () => void | - | Callback function when modal is closed |
title | string | - | Modal title |
description | string | - | Modal description/subtitle |
size | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Size of the modal |
showCloseButton | boolean | true | Shows the close button in the header |
children | ReactNode | - | 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)