modalar
v1.0.17
Published
Modalar is a small unopinionated react library for modals(dialogs) and alert.
Downloads
6
Readme
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.