--- title: "How to use Interactions in Dialog Box" slug: "how-to-use-interactions-in-dialog-box" updated: 2023-01-30T05:58:01Z published: 2023-01-30T05:58:01Z canonical: "help.pillir.io/how-to-use-interactions-in-dialog-box" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.pillir.io/llms.txt > Use this file to discover all available pages before exploring further. # How to set Logic to Open/Close a Dialog Box component? When a dialog box is added to a Page component, it is usually implemented to open and close by a trigger(eg: by click of a button). The trigger can be set in two ways: ### A) Using Interactions The user can use Interactions if the dialog box component should open and close on a **UI trigger**. To show a confirmation dialog box(ID: dialog_confirm) on click of a Delete button, do the following: Step 1: Drag and Drop **Delete** button in the Page component of the App Designer Step 2: In the button properties > Interactions, click the **+** icon to add an interaction Step 3: Choose onClick -> Open Dialog -> dialog_confirm ![Interactions-dialogbox](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/Interactions-dialogbox.png) Step 4: To close the dialog box, add event -> Close Dialog -> dialog_confirm interaction to the desired button component(in the Dialog box) and the desired event. ![Interactions-closeDialog](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/Interactions-closeDialog.png) NoteBy default, the Dialog box component in EdgeReady platform has a Close Dialog interaction added to a click event of all default buttons in the dialog box component.  ### B) Using Show Property The user can use the Show property if the dialog box should open and close through App Behavior. To show an error alert (eg: ID: dialog_alert) when a validation has failed in App Behavior, then do the following: Step 1: Create a business function variable (booleanShowDialog_confirm) Step 2: Map the variable in the Show property of the dialog_alert component Step 3: Set booleanShowDialog_confirm = “false”, in pageShow of the page which has the dialog box. (*This action is done to hide the dialog box when the page loads.*) Step 4: In the validation logic in App Behavior, when the validation fails, set booleanShowDialog_confirm = “true” to Open the dialog box during run-time Step 5: To close the dialog box, use set booleanShowDialog_confirm = “false” onClick of any of the dialog box buttons, OR if you would like to close the dialog_alert after 2 seconds, inside a setTimeOut block (with 2000 ms), set booleanShowDialog_confirm = “false” to close the dialog box automatically after 2 seconds. WarningTo avoid any run-time issues of the dialog box component **only one** of the above two methods should be used.