burgos-confirm
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

Confirm dialog

A hook, context and component for rendering @mui/material dialog globally with variable title, text content, button name and on confirm callback

Preparation

wrap your app in and place the component:

<ConfirmDialogProvider>
    <App />
    <ConfirmDialog />
<ConfirmDialogProvider/>

Usage

Use the useConfirmDialog hook to retrieve the method and call it passing the title, content and onConfirm as an object:

import { useConfirmDialog } from 'burgos-confirm'

export const App = () => {
    const { confirm } = useConfirmDialog()

    const handleClick = () => {
        confirm({
            title: 'Confirmation',
            content: 'Are you sure you want to delete this object?',
            onConfirm: () => console.log(' object deleted')
        })
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i burgos-confirm

Weekly Downloads

11

Version

1.3.1

License

ISC

Unpacked Size

14.6 kB

Total Files

20

Last publish

Collaborators

  • nandobfer