Edit page

Modal

Modals are meant to "take over" the screen and focus users attention on a dialog which presents the user with an opportunity to add, modify or create content. A Modal should always be centered both vertically and horizontally within the browser window. When a Modal is opened, the interface darkens and disables all other user interface elements in order to force a user to take an action required by their workflow. Two Modals can't be open at once.

Note: A Modal requires the appElement prop to be aria-compliant. Details on how to set this property can be found at http://reactcommunity.org/react-modal/accessibility/

Import Syntax

Example: Create a DOM element dynamically and pass it via appElement prop to Modal

Example: Pass an existing DOM element via appElement prop to Modal

Basic Usage

Open Modal Button

Props

PropertyTypeRequiredDefaultDescription
onAfterOpenFuncfalse() => {}Function that will be run after the Modal has opened.
onRequestCloseFuncfalse() => {}Function that will be run when the Modal is requested to be closed (either by clicking on overlay or pressing ESC).
shouldCloseOnOverlayClickBoolfalsetrueBoolean indicating if clicking the overlay should call the onRequestClose prop.
shouldCloseOnEscBoolfalsetrueBoolean indicating if pressing the esc key should call the onRequestClose prop.
showCloseBoolfalsetrueToggles visiblity of the close icon button.
childrenNodefalse-The content of the component.
openBoolfalse-Boolean describing if the Modal should be shown or not.
titleNodefalse-Node to be rendered as the modal title in the header
contentLabelStringfalse-String indicating how the content container should be announced to screenreaders.
actionsNodefalse-Buttons or links to be placed in the Modal actions footer.
secondaryActionsNodefalse-Buttons or links to be placed in the footer, opposite your primary actions.
colorEnumfalse-Adds a colored bar to the top of the Modal
noPaddingBoolfalse-Remove pading from content wrapper.
parentSelectorFuncfalse-Function that will be called to get the parent element to which the Modal will be attached.
overlayStyleObjectfalse-Styles applied to the overlay div.
dialogStyleObjectfalse-Styles applied to the container dialog div.
headerStylesObjectfalse-Styles applied to the header div.
titleStylesObjectfalse-Styles applied to the title div.
contentStylesObjectfalse-Styles applied to the content div.
actionStylesObjectfalse-Styles applied to the footer actions div.
secondaryActionStylesObjectfalse-Styles applied to the footer secondary actions div.

ModalActions