Modal
Last updated
Last updated
© 2024 UI Bakery
Modal serves as a container for a group of components displayed on a button click.
open()
opens modal
close()
closes modal
setOpenButtonDisabled(disabled: boolean)
sets button's state (enabled/ disabled)
Triggers allow you to launch certain actions based on different events.
On Init
Calls for an action on component initialization
On Open
Calls for an action on modal's button click
On Close
Calls for an action as the modal is closed
Modal component consists of a button that opens the modal, and the modal itself. You can customize the button and the modal based on your requirements. Let's check how to customize a modal in your application.
Start with adding a modal to the working area. Configure the appearance of the button by changing its color, text, and appearance. You can manage the visibility of the button or disable it based on a certain condition.
2. Next, let's customize the modal itself. Click on the modal's button to open it. You can adjust the size of the modal's layout or go with the default one. You can hide or show the modal's header and configure closing options for the modal with a backdrop click or ESC click if necessary.
Once you're done with the modal's design, you can customize its content. On the modal, you can combine different components. You can also copy-paste any existing component already configured in your application.
Let's display the data about a selected product inside the modal. Open the modal and drag a detail component on. In the Data field of the component, specify the reference to the necessary data: {{ui.productsTable.selectedRow.data}}
Let's make the modal open the product details by clicking on a table's row. Open your table's settings - Triggers tab. Find the On Row Select trigger and select Add a new Action. Choose the Code action and specify the code {{ui.modal.open()}}
. Now, upon a row selection, a modal will be opened.
Then, let's add a button that will remove the product and close the modal after that.
Bring a button onto the modal and customize its style.
Configure the action that will delete the record. Then, add another action step that will close the modal. Choose Code action type and specify the code {{ui.modal.close()}}
.
3. Finally, assign the delete action to the On Click trigger of the button.