1.1.1 • Published 11 months ago
react-bounded-draggable-modal v1.1.1
react-bounded-draggable-modal
A draggable modal component with boundary support for React and Next.js.
Installation
npm install react-bounded-draggable-modalor
yarn add react-bounded-draggable-modalUsage
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
| Name | Type | Description |
|---|---|---|
isOpen | boolean | Whether the modal is open or not. |
onOutsideClick | () => void | Function to handle clicks outside the modal. |
header | React.ReactNode | Content to be displayed in the modal header. |
children | React.ReactNode | Content to be displayed in the modal body. |
classNames | ClassNames | Optional class names for modal, header, and body. |
ClassNames
| Name | Type | Description |
|---|---|---|
modal | string | Class name for the modal container. |
header | string | Class name for the modal header. |
body | string | Class name for the modal body. |
License
MIT
1.1.1
11 months ago
1.1.0
11 months ago
1.0.15
11 months ago
1.0.14
11 months ago
1.0.13
11 months ago
1.0.12
11 months ago
1.0.11
11 months ago
1.0.10
11 months ago
1.0.9
11 months ago
1.0.8
11 months ago
1.0.7
11 months ago
1.0.6
11 months ago
1.0.5
11 months ago
1.0.4
11 months ago
1.0.3
11 months ago
1.0.2
11 months ago
1.0.1
11 months ago
1.0.0
11 months ago