Skip to main content

Modal

Modal component is an overlay for React Modal. You can pass any of the given props through Slipstream UI and can also make use of any available props React Modal provides.

Implementation#

import { Modal } from "slipstream-ui";
const Example = () => <Modal />;

Default#

<Modal isOpen={isOpen} toggle={_toggle}>
<Modal.Header title="Modal Title" />
<Modal.Body>...</Modal.Body>
<Modal.Footer className="justify-end">
<Modal.Button type="button" className="mr-2" color="link" close>
Cancel
</Modal.Button>
<Modal.Button type="button" onClick={_handleSave}>
Create
</Modal.Button>
</Modal.Footer>
</Modal>

Size#

<Modal size="4xl">....</Modal>

Bordered#

<Modal bordered>....</Modal>

Static Backdrop#

Disable click on backdrop to close the modal.

<Modal bordered>....</Modal>

Right-To-Left (rtl)#

<Modal rtl>....</Modal>

Props#

AttributeTypeValueDefault ValueDescription
bodyClassNamestringClass names for div surrounding the Modal.Body component
borderedbooleantrue/falseAdded border to Modal.Header and Modal.Footer
classNamestringAdd class names directly to ReactModal
contentLabelstringAdd contentLabel directly to ReactModal
durationnumber100/200/300/400/500/
600/700/800/900/1000
500Opacity transition when opening and closing the modal
isOpenbooleantrue/falseDictates if Modal is visible
isStaticbooleantrue/falseDisabled click event on modal backdrop
onOpenedfunctionAfter modal has opened and mounted, this function is invoked
overlayClassNamestringAdd class names to modal backdrop
rtlbooleantrue/falseChange content direction to right to left
sizestringxs/sm/md/lg/xl/
2xl/3xl/4xl/5xl/full
xlChange modal width size
styleobjectAdd styles to ReactModal
togglefunctionToggle opened Modal component