1.0.8 • Published 3 years ago

modal-react-library v1.0.8

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

A simple & lightweight method of displaying modal windows with React

Installation

In the project directory, you can run:

npm i modal-react-library

Import

You have to import Modal component in your application

import { Modal } from "modal-react-library"

Initialization

Use the modal like a React component

You have to initialize the Modal with useState

const [modalIsActive, setModalIsActive] = useState(false)

Render

You can render the modal in your component with

{modalIsActive && (<Modal buttonType="submit" buttonText="SUBMIT" htmlTextModal="bonjour" modalIsActive={modalIsActive} handleActiveModal={setModalIsActive} /> )}

Params

buttonType: "button" | "submit" | "reset"
buttonText: string of the text on the button
htmlTextModal: string of the text on the modal
modalIsActive: boolean
handleActiveModal: useState function

Example

alt text

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago