Figma Support Forum

Trigger variant state changes through events on other elements (or on overlay close)

I’d like to be able to trigger a component with variants to change its variant state through an event that happens elsewhere. Two examples that would be useful to us are:

  1. Clicking a button switches a table view from compact to comfortable
  2. Closing my overlay which confirms deleting a row in a table, should change my table component to an empty state. This should, by the way, only trigger the state change when clicking on a confirm button inside my overlay and closing the overlay, and not when I’m just closing the overlay only.

Do others have similar scenarios where this would be helpful?

Here a visual example: I have a list component with 4 variants. I also have a modal overlay. When clicking on the list view, the modal view is shown. When I click the ‘delete now’ button, the overlay should close and the component variant state should change to a list of 3 items.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.