JSPM

@saas-ui/modals

0.6.0-next.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4704
  • Score
    100M100P100Q134185F
  • License MIT

A modal manager for Chakra UI

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  --save

Usage

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