mg_modal
v1.0.8
Published
A simple and reusable React modal component
Maintainers
Readme
MG Modal
A simple React modal component.
Requirements
- Node.js version:
>=16.x - Package manager: npm
- Recommended editor: Visual Studio Code
Installation
npm install mg_modalUsage
import React, { useState } from 'react';
import MgModal from 'mg_modal';
const App() => {
const [showModal, setShowModal] = useState(false);
return (
<div>
<button onClick={() => setShowModal(true)}>Open Modal</button>
<MgModal
isOpen={showModal}
setIsOpen={setShowModal}
title="My Modal"
body="This is my modal content."
/>
</div>
);
}Props
| Prop | type | Description |
|------|-----|-----------|
| isOpen | boolean| Controls modal visibility |
| setIsOpen |function| State setter function to update visibility |
| title | string|Modal title (optional) |
| body |string| Modal content |
Development
To clone the component locally
# Clone the repository
git clone https://github.com/manelgasmi/mg_modal.git
License
MIT
