2.4.0 • Published 1 year ago

phpecoraro-npm-modal v2.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

NPM npm

Npm Modal

Modal for react application. Custom modal appears after form validation.

Contains:

  • header title
  • body for message
  • close button

Installation

To install:

npm install phpecoraro-npm-modal

Exemple

Then use it in your React app:

import { Modal } from 'phpecoraro-npm-modal'

<div>
    <button type="submit" className="formButton" onClick={() =>
        setShow(true)}
    >Save</button>
    <Modal title="Modal Title"
        onClose={() => setShow(false)} show={show}>
        <p>Modal Body</p>
    </Modal>
</div>

Enter your Title into "Modal Title", and your message into \Modal Body\ Show the modal when you click on the submit button.

3 possibilities to close the modal:

  • modal close button
  • escape keyboard key
  • when you click outside the modal