Skip to content

Instantly share code, notes, and snippets.

@markshust
Last active September 15, 2016 09:20
Show Gist options
  • Select an option

  • Save markshust/533d702dfb084ad337e2 to your computer and use it in GitHub Desktop.

Select an option

Save markshust/533d702dfb084ad337e2 to your computer and use it in GitHub Desktop.
custom dialog box using reactjs version of material design (material-ui)
const { Dialog, FlatButton, RaisedButton } = mui;
CustomDialog = React.createClass({
getInitialState() {
return {
showDialog: false
};
},
handlePrompt() {
this.setState({showDialog: true});
},
handleCancel() {
this.setState({showDialog: false});
},
handleConfirm() {
// Dialog button action here
},
render() {
return (
<div className='custom-dialog'>
<RaisedButton
label='Action Name'
onTouchTap={this.handlePrompt}
primary={true}
/>
<Dialog
title='Dialog Title'
open={this.state.showDialog}
actions={[
<FlatButton
label='Cancel'
onTouchTap={this.handleCancel}
style={{marginRight: 10}}
key={0}
/>,
<FlatButton
label='Confirm'
onTouchTap={this.handleConfirm}
primary={true}
key={1}
/>
]}
onRequestClose={() => this.handleCancel()}
>
Are you sure you want to do this?
</Dialog>
</div>
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment