phpecoraro-npm-modal
TypeScript icon, indicating that this package has built-in type declarations

2.4.0 • Public • Published

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 <p>Modal Body</p> 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

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i phpecoraro-npm-modal

    Weekly Downloads

    1

    Version

    2.4.0

    License

    MIT

    Unpacked Size

    10.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • phpecoraro