Skip to main content

Modal API

API documentation for the React Modal component. Learn about the available props.

Import


import { Modal } from 'repopup';

Props

PropsTypeDescriptionDefault
backgroundstringPopup window background (CSS background property).'#ffffff'
cancelButtonTextstringUse this to change the text on the "Cancel"-button.Cancel
childrenAfterDefaultContentReactNode | nullUse this to place children after default content of the popupnull
childrenBeforeDefaultContentReactNode | nullUse this to place children before default content of the popupnull
closeOnBackdropClickbooleanWheather or not to close the popup on clicking the backdroptrue
colorstringColor for title and content'#000000'
confirmButtonTextstringUse this to change the text on the "Confirm"-button.'Confirm'
customClassIModalCustomClassType;A custom CSS class for the popup{}
denyButtonTextstringUse this to change the text on the "Deny"-button.'Deny'
iconsuccess| error| info| warning| question| nullvarinat of a icon to be shownnull
onCancelReact.MouseEventHandler<HTMLButtonElement> | undefinedUse this as a click handler for the "Cancel"-button.() => {}
onConfirmReact.MouseEventHandler<HTMLButtonElement> | undefinedUse this as a click handler for the "Confirm"-button() => {}
onDenyReact.MouseEventHandler<HTMLButtonElement> | undefinedUse this as a click handler for the "Deny"-button.() => {}
onRequestCloseFunctionFunction that will be run when the modal is requested to be closedrequired
onSuccessReact.MouseEventHandler<HTMLButtonElement> | undefinedUse this as a click handler for the "Success"-button.() => {}
openbooleanBoolean describing if the modal should be shown or not.required
placement'top'| 'center' | 'bottom'| 'center-start'| 'bottom-start'| 'top-start'| 'top-end'| 'bottom-end'| 'center-end'Use this to change Popup window positioncenter
showCancelButtonbooleanIf set to true, a "Cancel"-button will be shown.false
showConfirmButtonbooleanIf set to true, a "Confirm"-button will be shown.false
showDenyButtonbooleanIf set to true, a "Deny"-button will be shown.false
showSuccessButtonbooleanIf set to true, a "Success"-button will be shown.false
subtitlestringUsed for a description for the popup.
successButtonTextstringUse this to change the text on the "Success"-button.Ok
titlestringUsed for the title of the popup

Demos