This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

react-common-mui-components
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

react-common-mui-components

React MaterialUI's common components

NPM JavaScript Style Guide

Install

This library requires MaterialUI v5 and React.JS v17.

To install this library run:

npm install --save react-common-mui-components

Or

yarn add react-common-mui-components

Components

ConfirmDialog

A basic confirm dialog that show up a MaterialUI Dialog with a title, message, and two buttons to confirm or cancel an action.

useConfirmDialog

A hook that provides a way to show the dialog with an imperative call.

import { useConfirmDialog } from "react-common-mui-components"
import { deleteRecords } from "somewere"

const Page = () => {
  const {Dialog, showDialog} = useConfirmDialog();

  function handleDelete(){
    showDialog(
      "Delete All Records",
      "Are you sure you want to delete these records?",
      ()=> deleteRecords(),
      {
        labels: {
          yes: {
            label: "Yes!",
            color: "error"
          },
          no: {
            label: "No!"
          }
        }
      }
    )
  }

  return (
    <div>
      <Button onClick={handleDelete}>Delete All Records</Button>
      ...
      {/* Don't forget to place the Dialog in the tree*/}
      <Dialog/>
    </div>
  )
}

License

MIT © Wladimir Guerra

Readme

Keywords

none

Package Sidebar

Install

npm i react-common-mui-components

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

12 kB

Total Files

17

Last publish

Collaborators

  • wladimirguerra