✔️ A great package to easily create beautiful modal in React.
✔️ In desktop devices in modal and in mobile device is draggable drawer.
✔️ In mobile device can close modal with dragging like instagram modals.
✔️ Close the modal by dragging the top of the modal in mobile devices.
✔️ You can apply your own styles based on the class names.
✔️ Lock Body scroll when modal opened.
Test in mobile mode to test draggable.
npm install --save rmodal-component
import Modal from 'rmodal-component';
import 'rmodal-component/dist/index.css'
import React, {useState} from 'react';
import Modal from 'rmodal-component';
const Example = () => {
const [show, setShow] = useState(false);
return (
<div>
<Modal show={show} onClose={() => setShow(false)} smModal={true} modalTitle={"modal Title"}>
...
</Modal>
</div>
);
};
export default Example;
Name | Default | Type | Description |
---|---|---|---|
modalTitle | required | string | set title for modal |
show | required | boolean | set true for show modal |
onClose | required | function | Runs when the modal is closing |
smModal | false | boolean | Reduces modal size |
lockBodyScroll | false | boolean | set true for lock body scroll when modal opened |