npm.io
1.0.17 • Published 6 years ago

modalar

Licence
ISC
Version
1.0.17
Deps
0
Size
11 kB
Vulns
0
Weekly
0

Modalar

Modalar is a small unopinionated react library for modals(dialogs) and alert.

Installation

Use npm or yarn to install modalar

NPM:

npm install modalar

yarn:

yarn install modalar

Usage

modal
import React from "react"
import { useModal, Modal } from "modalar"

const App = () => {
  const { toggle, show } = useModal()
  return (
    <div>
      <button onClick={toggle}>Show Modal</button>
      <Modal toggle={toggle} show={show}>
        <div>content of modal</div>
      </Modal>
    </div>
  )
}

export default App
alert
import React from "react"
import { showAlert } from "modalar"

const App = () => {
  return (
    <div>
      <button onClick={() => showAlert({ content: <div>content</div> })}>Show Alert</button>
    </div>
  )
}

export default App

Demo

modal
alert

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Keywords