easy-modal-hook
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Easy-Modal-Hook


Introduction

Easy-Modal-Hook is a simple React Modal Hook that can be attached to any html element



Quick Start

Install from:

npm install easy-modal-hook

Usage example:

import { useModal } from 'easy-modal-hook'

function App(): JSX.Element {
  const { Modal, open } = useModal({
    // Specify any html element id to attach the modal
    root: 'any-id',
    // Specify a custom icon to the close button (Default: Close)
    closeIcon: <SvgClose />
  })

  return (
    <div>
      <button onClick={open}>Open</button>
      <Modal>
        <>Hello World!</>
      </Modal>
    </div>
  )
}

License

The MIT License.

Readme

Keywords

Package Sidebar

Install

npm i easy-modal-hook

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

13.7 kB

Total Files

15

Last publish

Collaborators

  • joseluis-dev