1.2.2 • Published 4 years ago

react-modal-customizable v1.2.2

Weekly downloads
28
License
MIT
Repository
-
Last release
4 years ago

react-modal-customizable

This module allows to integrate a modals simply and customize in your react app.

Table of Contents

Installation

To install, you can use npm or yarn:

$ npm install react-modal-customizable
$ yarn add react-modal-customizable

Examples

import React from 'react';
import Modal from 'react-modal-customizable'

class Exemple extends React.Component {
    render() {
        return (
            <div className="development-screen screen">
                <Modal
                    ref={(modal) => this.modal = modal}
                    styleOverlay={{
                        backgroundColor: "black"
                    }}
                    styleContent={{
                        backgroudColor: "green"
                    }}
                    closeButton={true}
                    title="Your title"
                >
                    <div>Your content</div>
                </Modal>

                <button
                    onClick={ () => this.modal.showModal() }
                >
                    Show the modal
                </button>
            </div>
        )
    };
}

export default Example;

Props

General

PropsDescriptionTypeDefault
titleUse to set a title in the modalStringnull
closeButtonUse to show or hide the close buttonBooleantrue
hideClickOutsideUse to hide the modal if you click outsideBooleanfalse

Buttons

PropsDescriptionTypeDefault
buttonsUse to set multiple button.Array[]

Exemple :

<Modal
    buttons={
        [
            ...
            {
                value: "Delete",
                onClick: yourFunction,
                style: {
                    fontSize: "2rem"
                },
                type: "primary" 
            }
            ...
        ]
    }
/>

Parameters of the buttons

PropsDescriptionTypeDefault
valueText in the button.Stringnull
onClickAction of the click.Functionnull
styleStyle of the button.Object{}
typeType of the button. ("primary", "secondary", "success", "danger", "warning", "info", "light", "dark", "link")String"default"

Style

PropsDescriptionTypeDefault
styleContainerUse to change the style of the containerObject{}
styleOverlayUse to change the style of the overlayObject{}
styleContentUse to change the style of the contentObject{}
styleTitleUse to change the style of the titleObject{}
styleCloseButtonUse to change the style of the close buttonObject{}

Callbacks

PropsDescriptionTypeDefault
onShowCallback fired after show the modal.Functionnull
onHideCallback fired hide show the modal.Functionnull

Functions

showModal()

Use to show the modal.

this.modal.showModal()

hideModal()

this.modal.hideModal()

License

MIT

1.2.0

4 years ago

1.1.8

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 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.1

4 years ago

1.0.0

4 years ago