How to Toggle a Reply Panel Using Assignment Interaction
Last updated
Was this helpful?
Learn how to create a dynamic Show/Hide reply container using the Assignment interaction in the Avonni Dynamic Components App. This example demonstrates how to manage component state declaratively.
Build a UI where:
Clicking a Reply button displays a panel with input fields.
Clicking a Close icon inside the panel hides it again.
The panel visibility is managed using a Boolean variable and two Assignment interactions.
In the Resources panel:
Variable Type: Boolean
API Name: isReplying
Initial Value: false
This variable controls whether the reply panel is visible.

Drag a Container component onto the canvas.
Inside the container, add components like a Text Area to compose a reply.
This container will be shown or hidden based on the value of isReplying.
Place an Avonni Button component outside the container.
Label: Reply
Interaction Configuration (On Click):
Action Type: Assignment
Variable: {!isReplying}
Operator: equal
Value: true
Clicking the button sets
isReplyingtotrue, which will display the reply panel.

Drag an Icon component into the reply container.
Icon: utility:close or utility:delete
Interaction Configuration (On Click):
Action Type: Assignment
Variable: {!isReplying}
Operator: equal
Value: false
Clicking the icon resets the variable, hiding the container again.

Select the Container component.
Open the Set Component Visibility settings.
Add a condition:
Show when isReplying is equal to true.

When the page loads, isReplying is false, so the reply container is hidden.
Clicking the Reply button sets isReplying to true, making the container appear.
Clicking the Close icon sets it back to false, hiding it again.

All of this logic is handled declaratively with just two Assignment interactions—no custom code required
Last updated
Was this helpful?
Was this helpful?
