1.0.17 • Published 5 years ago
modalar v1.0.17
Modalar
Modalar is a small unopinionated react library for modals(dialogs) and alert.
Installation
Use npm or yarn to install modalar
NPM:
npm install modalaryarn:
yarn install modalarUsage
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 Appalert
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 AppDemo
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.