0.1.5 • Published 2 years ago

simple-react-modal-by-assamoi v0.1.5

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

A modal React component with customizable text content

About

This is a simple modal component made as part of a react project this modal is used to display a message when open you can choose the message and the theme for the close button

Installation

You can install this component with npm or yarn:

npm i simple-react-modal-by-assamoi

or

yarn add simple-react-modal-by-assamoi

Example

import React, { useState } from "react";
import { Modal } from "simple-react-modal-by-assamoi";

export default function App() {
  const [open, setOpen] = useState(false);

  // Choose modal text content
  const ModalContent = "You can write the content of your modal here !!";

  // Choose modal theme for close button
  const myTheme = {
    closeBtnColor: "#ffffff",
    closeBtnBgColor: "#008000",
  };

  return (
    <div>
      <button onClick={() => setOpen(true)} className="modal-btn">
        Open modal
      </button>
      <Modal
        open={open}
        content={ModalContent}
        theme={myTheme}
        onClose={() => setOpen(false)}
      />
    </div>
  );
}

Demo

npm.io

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago