0.2.5 • Published 3 years ago

npmreactmodal v0.2.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

npmreactmodal

Responsive modal dialog component for React.

Installation

To install, you can use npm :

$ npm install npmreactmodal
  • Use <Modal> tag inside your React app.

Exemple

In index.html file

  • add : <div id="modal-root"></div>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <title>React App</title>
  </head>
  <body>

    <div id="modal-root"></div>

    <div id="root"></div>
  </body>
</html>
}

In your componenet :

import { Modal, useModal } from 'npmreactmodal'
import React from 'react'
export default function Form() {
  window.React = React
  const { isShowing, toggle } = useModal()
  
  return (
    <main className="container">
      <h2 className="title">Create Employee</h2>
      <form className="form" onSubmit={handleSibmit}>
        (...)
         <button
            type="button"
            className="btn"
            onClick={toggle}
          >
            Save
          </button>
      </form>
      <Modal isShowing={isShowing} hide={toggle} text="your text here !/>
    </main>
  )
}
0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago