
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
material-ui-confirm
Advanced tools
Higher order component for straightforward use of @material-ui/core confirmation dialogs.
Confirming user choice is a good thing to do, it should also be easy to do.
This package provides simple confirmation dialogs built on top of @material-ui/core and straightforward to use thanks to React Hooks.
npm install --save material-ui-confirm
Wrap your app inside the ConfirmProvider
component.
Note: If you're using Material UI ThemeProvider
, make sure ConfirmProvider
is a child of it.
import React from 'react';
import { ConfirmProvider } from 'material-ui-confirm';
const App = () => {
return (
<ConfirmProvider>
{/* ... */}
</ConfirmProvider>
);
};
export default App;
Call the useConfirm
hook wherever you need the confirm
function.
import React from 'react';
import Button from '@material-ui/core/Button';
import { useConfirm } from 'material-ui-confirm';
const Item = () => {
const confirm = useConfirm();
const handleClick = () => {
confirm({ description: 'This action is permanent!' })
.then(() => { /* ... */ });
};
return (
<Button onClick={handleClick}>
Click
</Button>
);
};
export default Item;
ConfirmProvider
This component is required in order to render a dialog in the component tree.
Name | Type | Default | Description |
---|---|---|---|
defaultOptions | object | {} | Overrides the default options used by confirm . |
useConfirm() => confirm
This hook returns the confirm
function.
confirm([options]) => Promise
Thi function opens a confirmation dialog and returns a promise representing the user choice (resolved on confirmation and rejected otherwise).
Name | Type | Default | Description |
---|---|---|---|
title | string | 'Are you sure?' | Dialog title. |
description | string | '' | Dialog content. |
confirmationText | string | 'Ok' | Confirmation button caption. |
cancellationText | string | 'Cancel' | Cancellation button caption. |
dialogProps | object | {} | Material-UI Dialog props. |
2.0.2
FAQs
Simple confirmation dialogs built on top of @mui/material
The npm package material-ui-confirm receives a total of 40,894 weekly downloads. As such, material-ui-confirm popularity was classified as popular.
We found that material-ui-confirm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.