1.1.7 • Published 3 years ago

reactstrap-confirm-by-jdionicio v1.1.7

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

Reactstrap confirm by jdionicio

An easy to use promise based confirm dialog for reactstrap.

The objective of this modification is to offer developers a property to avoid user errors when clicking outside the elements or buttons

Installation

Simply use npm

npm i --save reactstrap-confirm-by-jdionicio

You can use yarn as well

yarn add reactstrap-confirm-by-jdionicio

Dependencies

You must manually install react, react-dom and reactstrap in your project in order for this module to work correctly.

Usage

Simply, import the module and call it as a function anywhere in your code.

import confirm from "reactstrap-confirm-by-jdionicio";

// ...code

let result = await confirm(); //will display a confirmation dialog with default settings

console.log(result); //if the user confirmed, the result value will be true, false otherwhise

You can also pass options to the confirm function:

confirm({
    title: (
        <>
            Content can have <strong>JSX</strong>!
        </>
    ),
    message: "This is a custom message",
    confirmText: "Custom confirm message",
    confirmColor: "primary",
    cancelColor: "link text-danger"
});

The above example will render a customized dialog.

Available options

OptionEffectDefault value
messageSets the message body of the confirmation dialogAre you sure?
titleSets the title of the dialog windowWarning!
confirmTextSets the text of the confirm buttonOk
cancelTextSets the text of the cancel buttonCancel
confirmColorSets the color class of the confirm button (see reactstrap docs)primary
cancelColorSets the color class of the cancel button (see reactstrap docs)empty
sizeSets the size property for the modal component (see reactstrap docs)empty
buttonsComponentCan receive a component for rendering the buttons. The component will receive the onClose function as a prop.empty
closedforContentAvoid closing the modal when clicking on the div that contains it.true
zIndexModalUse to display above a modal999
styleHeaderuse to add styles in lineempty
styleFooteruse to add styles in lineempty
1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago