@malcodeman/react-modal

1.0.6 • Public • Published

react-modal

GitHub license npm code style: prettier

The Modal component is used to show content on top of an overlay. It blocks any interaction with the page — until the overlay is clicked, or a close action is triggered.

Getting started

yarn add @malcodeman/react-modal
# or
npm install --save @malcodeman/react-modal
import React from "react";
import { Modal } from "@malcodeman/react-modal";

function App() {
  const [isOpen, setIsOpen] = React.useState(false);

  function onClick() {
    setIsOpen(!isOpen);
  }

  function onClose() {
    setIsOpen(false);
  }

  return (
    <>
      <button onClick={onClick}>Trigger Modal</button>
      <Modal isOpen={isOpen} onClose={onClose}>
        <div>Modal</div>
      </Modal>
    </>
  );
}

export default App;

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @malcodeman/react-modal

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

20.8 kB

Total Files

6

Last publish

Collaborators

  • malcodeman