1.1.1 • Published 1 year ago

react-modal-oc v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Modal React Component

This is a simple modal React component that you can use in your projects.

Installation

You can install the component using npm:

npm install --save react-modal

Usage

To use the modal component, you need to import it into your React project:

import { Modal } from "react-modal-oc";

<Modal isOpen={true} onRequestClose={() => setIsOpen(false)}>
  <h2>Modal Title</h2>
  <p>Modal content goes here.</p>
</Modal>;

The isOpen prop controls whether the modal is visible or hidden, and the onRequestClose prop is a function that will be called when the user clicks outside the modal or presses the escape key.

You can customize the style of the modal and its content by passing in style and contentStyle props respectively.

<Modal
  isOpen={true}
  onRequestClose={() => setIsOpen(false)}
  style={{ backgroundColor: "rgba(0, 0, 0, 0.5)" }}
  contentStyle={{ padding: "40px" }}
>
  <h2>Modal Title</h2>
  <p>Modal content goes here.</p>
</Modal>

Props

NameTypeDefault ValueDescription
isOpenbooleanfalseDetermines whether the modal is open or closed.
onRequestClosefunctionundefinedFunction to close the modal.
styleobject{}Style object for the modal container.
contentStyleobject{}Style object for the modal content container.
1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago