2.0.0 • Published 5 years ago

@casper124578/react-modal v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

react-modal

Reusable react components to get a simple modal with ease! Highly customizable and responsive.

Table of Contents

Installation

npm

npm install @casper124578/react-modal

yarn

yarn add @casper124578/react-modal

Usage

import React from "react";
import { Modal } from "@casper124578/react-modal";

function App() {
  const openModal = () => {
    document.querySelector("#modal_id").classList.add("active");
  };

  return (
    <div className="App">
      <button onClick={openModal}>Open Modal</button>

      <Modal transitionSeconds={0.3} id="modal_id" title="Hello world">
        This is the modal body, this is cool huh? I think it is!
        <p style={{ color: "green" }}>it can also render HTML</p>
      </Modal>
    </div>
  );
}

Available Props

OptionTypeDescriptionrequireddefault
titlestringThe title of the modaltrueEmpty string
idstringThe ID of the modal, required to open/close modaltrueEmpty string
widthstringThe width of the modalfalse600px
heightstringThe height of the modalfalseauto
bgColorstringbackground color of the modalfalsewhite
textColorstringtext color of the modalfalseblack
borderRadiusstringborder-radius of the modalfalse10px
transitionSecondsnumberAmount of seconds the modal should transitionfalse0.3
2.0.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago