0.1.12 • Published 3 years ago

react-standard-modal v0.1.12

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

react-standard-modal

A clean & simple modal component for React.

npm npm npm bundle size GitHub PRs Welcome

Table of Contents

Demos

Installation

To install use yarn,

$ yarn add react-standard-modal

or npm,

$ npm install --save react-standard-modal

Basic usage

import React, { Fragment, useState } from 'react';
import Modal from 'react-standard-modal';

function App() {
  const [isOpen, setIsOpen] = useState(false);
  const handleClose = () => {
    setIsOpen(false);
  };

  return (
    <Fragment>
      <Button onClick={() => setIsOpen(true)}>Open modal</Button>
      <Modal open={isOpen} onClose={handleClose}>
        {body}
      </Modal>
    </Fragment>
  );
}

API documentation

PropTypeRequiredDescription
childrennodeProvide the contents of your Modal
className{ Modal: string, Overlay: string, Portal: string }Class names for Modal, Portal and Overlay components
closeOnOverlayClickbooleanTodo: Closes the modal when clicking on Overlay.
disableOverlayClickbooleanDisables Overlay click
disableOverlaybooleanSpecify whether Overlay should render or not. If true, Overlay component will not render.
disablePortalbooleanIf true, Modal & Overlay will mount inside the parent component.
onClosefunctionSpecify the function that fires on Modal closes.
onOpenfunctionSpecify the function that fires on Modal opens.
openbooleanSpecify whether the Modal is currently open.
overlayClickfunctionSpecify the function that fires when clicking on Overlay.
overlayReffunctionRef callback of the Overlay component.
style{ Modal: object, Overlay: object, Portal: object }Inline styles for Modal, Portal and Overlay components.
unMountIfClosedbooleanIf true, the modal will not mount to DOM when it's not open.

License

MIT

Contribute

Contributions of any kind welcome!

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago