Demo & Example
Features
- Animated
- Customizable
- Responsive
Installation
npm install react-remodal --save
Usage
// options to createRemodal are optional, see 'Customization' section.const Remodal = state = isModalOpen: false { this } { return <div> <button onClick=::thistoggleModal> Open modal </button> <Remodal isOpen=thisstateisModalOpen onClose=::thistoggleModal> <h1> Lorem ipsum dolor sit amet </h1> <p> Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est laborum </p> </Remodal> </div> }
Customization
React remodal animates the dialog and overlay with css classes. You can pass
custom classes to createRemodal
. See below:
const Remodal =
Props
- isOpen - (bool) if the modal is open (default = false)
- onClose - (function) callback on close
- overlayClosesModal - (bool) if clicking on the overlay closes the modal (requires onClose)
- closeOnEscape - (bool) if keyboard escape closes the modal (requires onClose)
Recommendations
It is recommended to add overflow-y: scroll;
to your body css, this way
we prevent "jumpy" content.
Development
npm start