0.2.0 • Published 7 years ago

material-ui-confirm-button v0.2.0

Weekly downloads
17
License
MIT
Repository
github
Last release
7 years ago

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:

PropertyTypeDescriptionRequired
onSubmitfunctionCallback for confirmed actiontrue
onOpenfunctionCallback for initial button pressfalse
onCancelfunctionCallback for canceling of actionfalse
isFlatboolWhether to use FlatButton. Uses RaisedButton by default.false
labelstringMessage to display in initial button.false
iconcomponentIcon to display in initial button. This conflicts with labelfalse
cancelMessagestringMessage to display in cancel button. Defaults to "Cancel"false
cancelIconcomponentIcon to display in cancel button. This conflicts with cancelMessagefalse
confirmMessagestringMessage to display in confirm button. Defaults to "Confirm"false
confirmIconcomponentIcon to display in confirm button. This conflicts with confirmMessagefalse
isOpenboolFlag 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)