1.1.1 • Published 4 months ago

react-bounded-draggable-modal v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

react-bounded-draggable-modal

A draggable modal component with boundary support for React and Next.js.

Installation

npm install react-bounded-draggable-modal

or

yarn add react-bounded-draggable-modal

Usage

import React, { useState } from "react";
import Modal from "react-bounded-draggable-modal";

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

  const handleOutsideClick = () => {
    setIsOpen(false);
  };

  return (
    <div>
      <button onClick={() => setIsOpen(true)}>Open Modal</button>
      <Modal
        isOpen={isOpen}
        onOutsideClick={handleOutsideClick}
        header={<div>Modal Header</div>}
        classNames={{
          modal: "custom-modal",
          header: "custom-header",
          body: "custom-body",
        }}
      >
        <div>Modal Content</div>
      </Modal>
    </div>
  );
};

export default App;

Props

ModalProps

NameTypeDescription
isOpenbooleanWhether the modal is open or not.
onOutsideClick() => voidFunction to handle clicks outside the modal.
headerReact.ReactNodeContent to be displayed in the modal header.
childrenReact.ReactNodeContent to be displayed in the modal body.
classNamesClassNamesOptional class names for modal, header, and body.

ClassNames

NameTypeDescription
modalstringClass name for the modal container.
headerstringClass name for the modal header.
bodystringClass name for the modal body.

License

MIT

1.1.1

4 months ago

1.1.0

4 months ago

1.0.15

4 months ago

1.0.14

4 months ago

1.0.13

4 months ago

1.0.12

4 months ago

1.0.11

4 months ago

1.0.10

4 months ago

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago