rjs-simple-modal
v1.0.1
Published
Made with create-react-library
Downloads
3
Readme
rjs-simple-modal
create-react-library
Install
npm install --save rjs-simple-modal
Usage
import React from 'react'
import { Modal,useModal } from 'rjs-simple-modal'
import 'rjs-simple-modal/dist/index.css'
function App() {
const { showModal, Toggle } = useModal();
return (
<div className="App">
<div className="demo">
<h1>REACT SIMPLE MODAL</h1>
<button type="button" onClick={()=>{Toggle()}}>
Simple Modal
</button>
</div>
<Modal show={showModal} close={Toggle} title="My Modal">je suis une modal</Modal>
</div>
);
}
export default App;
Usage Public directory
Add modal in the index.html
<div id="modal"></div>
<div id="root"></div>
Props
| Props | Type | Required | Default | Description | | :--------------- |:---------------:| :---------------:| :---------------:| -----:| | showModal | Bool | Required | False | State allows you to display the modal | | Close | Function | Required | - | Function allows you to remove the modal | | title | String | Required | - | Add title modal | | children | String | Required | - | Add content modal |
License
MIT © Mkiera972