0.2.0 • Published 2 years ago
modal-comp-for-react v0.2.0
A simple Modal component for React
Looking for the lastest version ?
Prerequisites
How to install the Modal to your project
- Inside your project, the
npm i modal-comp-for-react
command will allow you to install the component. - In your App, you need to declare a state for the modal in the parent element.
const [popupActive, setPopupActive] = useState(false);
- Then, you can import the element from the node module
import { Popup } from 'modal-comp-for-react';
- When you create the component in your app, you need two mandatories props
showPopup={popupActive} closePopup={() => setPopupActive(false)}
How to customize the Modal ?
- You can pass any children you want inside the component ?
<Popup showPopup={popupActive} closePopup={() => setPopupActive(false)} > Employee Created! </Popup>
- By default, there is an overlay behind the popup. You can remove it by changing the overlay props to false
<Popup showPopup={popupActive} closePopup={() => setPopupActive(false)} overlay={false} > Employee Created! </Popup>