# react-confirm-alert react component confirm dialog. [Live demo](https://ga-mo.github.io/react-confirm-alert/demo/) [![npm version](https://badge.fury.io/js/react-confirm-alert.svg)](https://badge.fury.io/js/react-confirm-alert) Document for v.1.x.x [see](https://github.com/GA-MO/react-confirm-alert/blob/master/Document-v1.md) ## Getting started #### Install with NPM: ``` $ npm install react-confirm-alert --save ``` #### Options ```jsx const options = { title: 'Title', message: 'Message', buttons: [ { label: 'Yes', onClick: () => alert('Click Yes') }, { label: 'No', onClick: () => alert('Click No') } ], childrenElement: () =>
, customUI: ({ onClose }) =>
Custom UI
, closeOnEscape: true, closeOnClickOutside: true, willUnmount: () => {}, afterClose: () => {} onClickOutside: () => {}, onKeypressEscape: () => {}, overlayClassName: "overlay-custom-class-name" }; confirmAlert(options); ``` #### Use with function: ```jsx import { confirmAlert } from 'react-confirm-alert'; // Import import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css class App extends React.Component { submit = () => { confirmAlert({ title: 'Confirm to submit', message: 'Are you sure to do this.', buttons: [ { label: 'Yes', onClick: () => alert('Click Yes') }, { label: 'No', onClick: () => alert('Click No') } ] }); }; render() { return (
); } } ``` #### Custom UI Component ```js confirmAlert({ customUI: ({ onClose }) => { return (

Are you sure?

You want to delete this file?

); } }); ```