2.0.1 • Published 5 months ago

simple-modal-jr-lib v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

simple-modal-jr-lib

Simple modal library

NPM JavaScript Style Guide

Install

npm install --save simple-modal-jr-lib

Usage

import React, { useState } from 'react'
import Modal from 'simple-modal-jr-lib'
import 'simple-modal-jr-lib/dist/index.css'

export default function Example() {
  const [openModal, setOpenModal] = useState(false) // this hook will determine when the modal opens or closes
  return (
    <div className='Example'>
      <h1>Modal Test</h1>
      <button onClick={() => setOpenModal(true)}>Open Modal</button>{' '}
      {/* We set the OpenModal hook on true to open the modal when we click on the button */}
      <Modal isOpen={openModal} onClose={() => setOpenModal(false)}>
        <p>Exemple text !</p>
      </Modal>
      {/* The modal component needs at least the 'setIsOpen' and the onClose function  */}
    </div>
  )
}

## License

MIT © [RenierJordan](https://github.com/RenierJordan)

Customisation

PropsDescriptionType
isOpen/!\Required/!\ this will allow the component to change the state to "false" to close the modalboolean
onClose/!\Required/!\ this will be called to close the modalfunction
2.0.1

5 months ago

2.0.0

5 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago