I have a checkbox component that changes to a “checked” variant when clicked. When I click on an instance of this component, I want to set a variable. But when I add the “on click” interaction to set the variable, it overrides the component interaction, so the checkbox doesn’t get checked anymore.
Is this possible to do in Figma?
There is an imperfect solution. I can add an extra “Change to” action on click, and change it to the “Checked” variant. This works, although it forces me to replicate an interaction that already exists on the component, only to set a variable. It also means I cannot click on it again to un-check the checkbox.
set the variable change on “onMouseUp” trigger next to onClick
@MaxZuman That doesn’t work, unfortunately. It still deactivates the inherited component interaction, so the checkbox doesn’t get checked.
It looks like I can use the “While pressing” trigger to retain the component interaction, and also set the variable. I don’t know why this works, but it seems to solve my problem.