3.2.0 • Published 4 years ago

@opuscapita/react-confirmation-dialog v3.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

react-confirmation-dialog

Description

A modal popup dialog component with yes/no and an optional third, middle button.

Installation

npm install @opuscapita/react-confirmation-dialog

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

Prop nameTypeDefaultDescription
idstringoc-confirm-dialogString prefix for the HTML ID's
translationsobject of string, element{ ok: 'OK', cancel: 'Cancel', thirdButton: '', title: 'Title', body: 'Body' }Translation texts
cancelCallbackfunctionCallback to function executed on cancel button click
confirmCallbackfunctionCallback to function executed on confirm button click
okButtonDisabledboolfalseDisabled status of the confirm button
classNamestring''Optional class name for Modal
thirdButtonCallbackfunctionundefinedCallback to function executed on middle button click
thirdButtonDisabledboolfalseDisabled status of the middle button
paintConfirmButtonOrangebooltrueDetermines whether confirm button should be orange
paintThirdButtonOrangeboolfalseDetermines whether middle button should be orange
paintCancelButtonOrangeboolfalseDetermines whether cancel button should be orange
footerContentstring, nodeundefinedContent displayed on the left side of the footer
modalPropsobject{}Bootstrap Modal props

Code example

import ConfirmDialog from '@opuscapita/react-confirmation-dialog';

class ConfirmDialogView extends React.Component {
  constructor() {
    this.state = {
      showConfirmationDialog: false;
    }
  }

  hideConfirmDialog = () => {
    this.setState({
      showConfirmationDialog: false
    });
  }

  showConfirmDialog = () => {
    this.setState({
      showConfirmationDialog: true
    });
  }

  render() {
    return (
        this.state.showConfirmationDialog &&
        <ConfirmDialog
          localizationTexts={{
            title: 'Confirmation',
            body: 'Are you sure you want to do this?',
          }}
          cancelCallback={this.hideConfirmDialog}
          confirmCallback={this.confirmAction}
        />
    );
  }
}
3.2.0

4 years ago

3.1.3

4 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago