Composant Modal React simple (overlay, fermeture au clic extérieur + bouton de fermeture), extrait du projet HRnet.
npm install react-modal-wealthealthnpm install @ton-scope/wealthealth-modal
npm install sass
jsx
import { useState } from "react";
import Modal from "@ton-scope/wealthealth-modal";
export default function Example() {
const [isOpen, setIsOpen] = useState(false);
return (
<>
setIsOpen(false)}>
Employé créé
Le nouvel employé a bien été enregistré.
>
);
}
`
---
Props
| Prop | Type | Obligatoire | Description |
| ---------- | ------------ | ----------- | -------------------------------------- |
| isOpen | boolean | Oui | Affiche/masque la modale |
| onClose | () => void | Oui | Fonction appelée pour fermer la modale |
| children | ReactNode` | Oui | Contenu affiché dans la modale |