Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Flexible confirmation button for Material UI in React

Notifications You must be signed in to change notification settings

katerberg/material-ui-confirm-button

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Material UI Confirm Button

demo


This is a component that allows inline confirmation of a button press. It is highly customizable and allows most of the options of either FlatButton or RaisedButton from Material-UI.

Installation

npm install --save material-ui-confirm-button

Usage

The confirm button visible in the demo above was created as follows:

import ConfirmButton from 'material-ui-confirm-button';
import Delete from 'material-ui/svg-icons/action/delete';

<ConfirmButton icon={<Delete />}
    confirmMessage="Delete"                      
    onSubmit={() => this.props.deleteModel()} />

Obviously, you can use this without the ES6 syntax and without material icons.

Note that all properties are forwarded to the button by default, so anything that is useful on the material buttons can be used here as well.

The only properties that are intercepted are these:

Property Type Description Required
onSubmit function Callback for confirmed action true
onOpen function Callback for initial button press false
onCancel function Callback for canceling of action false
isFlat bool Whether to use FlatButton. Uses RaisedButton by default. false
label string Message to display in initial button. false
icon component Icon to display in initial button. This conflicts with label false
cancelMessage string Message to display in cancel button. Defaults to "Cancel" false
cancelIcon component Icon to display in cancel button. This conflicts with cancelMessage false
confirmMessage string Message to display in confirm button. Defaults to "Confirm" false
confirmIcon component Icon to display in confirm button. This conflicts with confirmMessage false
isOpen bool Flag for controlling state. BEWARE: This will become a Controlled Component. false

Small Print

License

Material UI Confirm Button is released under the MIT license.

Author

Mark Katerberg (@diablomarcus)