Skip to main content
Version: 2.50.0-LTS

Modal

The Modal widget renders in front of a backdrop, and it blocks interaction with the rest of the application until the modal is closed. It can be used to add dialog boxes to your app for lightboxes, user notifications, forms, etc.

Restricted components

In order to avoid excessively complex situations, certain components, namely Calendar and Kanban, are restricted from being placed within the Modal component using drag-and-drop functionality.

If the builder attempts to add any of the aforementioned components inside the Modal, an error message will be displayed:

<Restricted component> cannot be used as a child component within the Modal.

Add Widgets to Modal

To add widgets to the Modals please refer to Tutorial - Adding widgets to a modal

Properties

Property
Description
TitleTitle that should be shown on the header of the modal.
Loading stateLoading state can be used to show a spinner on the modal content. Loading state is commonly used with isLoading property of the queries to show a loading status while a query is being run. Enable the toggle On or click on fx to programmatically set the value {{true}} or {{false}} .
Hide title barEnabling this option hides the title bar in the modal. The value {{true}} or {{false}} can be set programmatically by clicking on the Fx button next to it.
Hide close buttonBy enabling this option, the close button within the modal will be hidden. The value can be programmatically set to either {{true}} or {{false}} by clicking the adjacent Fx button.
Close on escape keyEnabling this option will cause the modal to close whenever the escape key is pressed. The value can be programmatically set to either {{true}} or {{false}} by clicking the adjacent Fx button. This property is enabled by default.
Close on outside clickEnabling this feature will result in the modal closing when clicked outside of its boundaries. The value can be programmatically set to either {{true}} or {{false}} by clicking the adjacent Fx button.
Modal sizeDetermines the size of the modal. Available options include medium, small, and large, with the default set to medium. The value can also be programmatically configured by clicking the Fx button and setting it to sm, md, or lg.
Modal heightSpecifies the height of the modal, with the default height set to 400px. The modal's height can also be dynamically set using JS binding by utilizing the {{components.xyz.data.key === 'Sun' ?? '600px' : '300px'}} syntax.

Events

Modal supports the following two events:

  • On open
  • On close
info

Just like any other event on ToolJet, you can set multiple handlers for the events supported by Modal. Check all the actions here.

Component Specific Actions (CSA)

Following actions of Modal component can be controlled using the component specific actions(CSA):

Actions
Description
How To Access
openControl the opening and closing of the Modal component via a component-specific action within any event handler.Employ a RunJS query to execute component-specific actions such as await components.modal1.open()
closeControl the closing of the Modal component via a component-specific action within any event handler.Employ a RunJS query to execute component-specific actions such as await components.modal1.close()

Exposed Variables

There are currently no exposed variables for the component.

Options

Option
Description
Use default trigger buttonThe default trigger button is enabled by default, this button can be used to show the modal. The value {{true}} or {{false}} can be set programmatically by clicking on the Fx button next to it.
Trigger button labelIt can be used to set the label of the trigger button.
info

A modal can be triggered using the default trigger button, action or via JavaScript.

Layout

Layout
Description
Expected Value
Show on desktopToggle on or off to display desktop view.You can programmatically determining the value by clicking on Fx to set the value {{true}} or {{false}}
Show on mobileToggle on or off to display mobile view.You can programmatically determining the value by clicking on Fx to set the value {{true}} or {{false}}

Styles

Style
Description
Value
Header background colorChange the background color of the header in modalEnter the Hex color code or choose a color of your choice from the color picker
Header title colorChange the color of the Title in modalEnter the Hex color code or choose a color of your choice from the color picker
Body background colorChange the background color of the body in modalEnter the Hex color code or choose a color of your choice from the color picker
VisibilityToggle on or off to control the visibility of the default trigger button that comes with modalYou can programmatically change its value by clicking on the Fx button next to it. If {{false}} the button will not visible after the app is released. By default, it's set to {{true}}.
DisableToggle on to disable the default trigger button that comes with modalYou can programmatically change its value by clicking on the Fx button next to it, if set to {{true}}, the button will be locked and becomes non-functional. By default, its value is set to {{false}}.
Trigger button background colorChange the background color of the default trigger button of modalEnter the Hex color code or choose a color of your choice from the color picker
Trigger button text colorChange the color of the label in default trigger button of modalEnter the Hex color code or choose a color of your choice from the color picker
info

Trigger Button styles are only visible when Use default trigger button under Options is toggled on.