Package Exports
- @saas-ui/modals
- @saas-ui/modals/src
Readme
@saas-ui/modal
A modal manager for Chakra UI
Installation
$ yarn add @saas-ui/modals
#or
$ npm i @saas-ui/modals  --saveUsage
Add the ModalProvider to your app.
import { ModalsProvider } from '@saas-ui/modals'
export default App() {
  return (
    <ModalsProvider>
      {children}
    </ModalsProvider>
  )
}Open a modal
import { useModals } from '@saas-ui/modals'
function MyComponent() {
  const modals = useModals()
  modals.open({
    title: 'My modal',
    body: <>My modal body</>,
  })
}Open a drawer
import { useModals } from '@saas-ui/modals'
function MyComponent() {
  const modals = useModals()
  modals.drawer({
    title: 'My drawer',
    body: <>My drawer body</>,
  })
}Open a confirm dialog
import { useModals } from '@saas-ui/modals'
function MyComponent() {
  const modals = useModals()
  modals.confirm({
    title: 'Delete user',
    body: 'Are you sure you want to delete this user?'
    onConfirm: () => //delete user
  })
}License
MIT - Appulse Software