1.0.6 • Published 4 years ago

@malcodeman/react-modal v1.0.6

Weekly downloads
78
License
MIT
Repository
github
Last release
4 years ago

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

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago