0.0.10 • Published 1 year ago

@fabiendev/react-modal-component v0.0.10

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

React Modal Component

Presentation

Customizable modal component for React JS

Install the modal

Use NPM command:

npm i @fabiendev/react-modal-component

Import modal in your project

import  ReactModalComponent  from "@fabiendev/react-modal-component";

Example in component

import { useState } from "react";
import ReactModalComponent  from "@fabiendev/react-modal-component";

const ModalExample = () => {
    const [displayModal, setDisplayModal] = useState(false);
    const toggleModal = () => setDisplayModal(!displayModal);

    return (
        <div>
            <h2>Modal Example</h2>
            <button onClick={toggleModal}>Open Modale</button>
            {displayModal &&
                <ReactModalComponent
                    hideModal={toggleModal}
                    title="Modal Title"
                    darkMode
                    modalSize="large"
                >
                    <p>Message in modal</p>
                </ReactModalComponent>
            }
        </div>
    );
};

export default ModalExample;

Properties

PropertiesTypesRequired
hideModalfunctionX
titlestring
childrennodeX
darkModebool
modalSizestring
customModalWidthstring
customModalHeightstring
modalTextColorstring
closeBtnContainerColorstring

Properties description

  • hideModal {function}: Function to hide modal
    • example:
          hideModal={toggleModal}
  • title {string}: Title of modal
    • example:
          title="Modal Title"
  • children {node}: Content to display inside modal
    • example:
          <ReactModalComponent>
              <p>Message in modal</p>
          </ReactModalComponent>
  • darkMode {bool}: Whether to display modal in dark mode
    • example:
          darkMode={true}
  • modalSize {string}: Predefined size of modal ("large", "medium", "small")
    • example:
          modalSize="large"
  • customModalWidth {string}: Custom width for modal
    • example:
          customModalWidth="500px"
  • customModalHeight {string}: Custom height for modal
    • example:
          customModalHeight="500px"
  • modalTextColor {string}: Text color for modal
    • example:
          modalTextColor="#93AD18"
  • closeBtnContainerColor {string}: Background color for close button
    • example:
          closeBtnContainerColor="#748813"

NPM Package

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago