Components
Home
Packages
Modal
Name
@happeouikit/modals
Latest
2.0.16
License
MIT
Installation
yarn add @happeouikit/modals
Links
Dependencies (2)
@happeo/react-core@^0.9.0
react-modal@^3.16.1
Modal
ConfirmModal
isOpen
boolean
close
() => void
() => {}
bodyText
string
header
ReactNode
okCb
() => void
() => {}
id
string | undefined
hideCancel
boolean | undefined
state
MODAL_STATES
MODAL_STATES.success
btnDisabled
boolean | undefined
okText
string
OK
cancelText
string
Cancel
width
string | undefined
350px
closeOnClickOutside
boolean | undefined
closeOnEsc
boolean | undefined
autoFocusCancel
boolean | undefined
autoFocusOk
boolean | undefined
dataTracker
string | undefined
Examples
Success ConfirmModal
Info ConfirmModal
Warn ConfirmModal
Alert ConfirmModal
Alert ConfirmModal with custom body
Modal with long text and header and custom css for the overlay
Modal with Close icon
Make sure to provide both close
function and iconClose={true}
Modal with custom footer and no header
Customize modal with anything inside. Here's an example to have a custom footer.
Modal that closes when you click outside
If you provide the closeOnClickOutside
prop, the modal will automatically close when you click outside of it.
Modal that only closes when you click on backdrop
If you provide the prop reactModalProps to Modal component:
// reactModalProps = {{// onRequestClose: () => {close();},// shouldCloseOnOverlayClick: true// }}
The modal will automatically close when you click on backdrop of it. Top left of the screen there is a portal on which you can click and see that modal does not close
When closeOnClickOutside is usedModal that closes when you click on something that is not in modal root Top left of the screen there is a portal on which you can click and see that modal does close
// closeOnClickOutsideconst closeOnClickOutside=true;