Skip to main content

Modal

Ant Design

The Modal component is Ant Design's dialog. It opens over the app to confirm an action or collect input in its own components, and closes with OK, Cancel or the close button.

Properties​

Property
Description
Expected Value
Trigger textText on the trigger button that opens the modal.Text. Default: Open
Show triggerShows a button on the canvas that opens the modal. Turn it off to open the modal only with the Show action.On or off. Default: On
TitleHeading at the top of the modal.Text. Default: Modal title
ContentText shown above the components in the modal body.Text
OK textText on the OK button.Text. Default: OK
Cancel textText on the Cancel button.Text. Default: Cancel
OK typeStyle of the OK button. Use danger for actions that delete or remove data.primary, danger. Default: primary
FooterShows the OK and Cancel buttons at the bottom of the modal.On or off. Default: On
Width (px)Width of the modal.Number. Default: 520
Body height (px)Height of the area that holds components inside the modal. Set it to 0 for a modal with no components.Number. Default: 200
CenteredPlaces the modal in the middle of the screen instead of near the top.On or off. Default: On
ClosableShows the close button in the top right corner.On or off. Default: On
Mask closableCloses the modal when the user clicks the dimmed area around it.On or off. Default: On

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On okTriggers when the user clicks the OK button. The modal closes.
On cancelTriggers when the user closes the modal with Cancel, the close button, the dimmed area or the Escape key.
After openTriggers when the modal has finished opening.
After closeTriggers when the modal has finished closing.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
ShowOpens the modal.components.modal1.show()
HideCloses the modal.components.modal1.hide()
Set visibilityShows the component when true, hides it when false.components.modal1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.modal1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.modal1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
triggerTextText on the trigger button that opens the modal.{{components.modal1.triggerText}}
showTriggerShows a button on the canvas that opens the modal. Turn it off to open the modal only with the Show action.{{components.modal1.showTrigger}}
titleHeading at the top of the modal.{{components.modal1.title}}
contentText shown above the components in the modal body.{{components.modal1.content}}
okTextText on the OK button.{{components.modal1.okText}}
cancelTextText on the Cancel button.{{components.modal1.cancelText}}
okTypeStyle of the OK button. Use danger for actions that delete or remove data.{{components.modal1.okType}}
footerShows the OK and Cancel buttons at the bottom of the modal.{{components.modal1.footer}}
widthWidth of the modal.{{components.modal1.width}}
bodyHeightHeight of the area that holds components inside the modal. Set it to 0 for a modal with no components.{{components.modal1.bodyHeight}}
centeredPlaces the modal in the middle of the screen instead of near the top.{{components.modal1.centered}}
closableShows the close button in the top right corner.{{components.modal1.closable}}
maskClosableCloses the modal when the user clicks the dimmed area around it.{{components.modal1.maskClosable}}
opentrue while the modal is open.{{components.modal1.open}}
isVisibleWhether the component is visible.{{components.modal1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.modal1.isLoading}}
isDisabledWhether the component is disabled.{{components.modal1.isDisabled}}

Styles​

Style
Default
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border radius—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.