Skip to content

joseluis-dev/easy-modal-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Simple React Modal Hook that can be attached to any html element

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published