Variables & Conditional Problem

I’m trying to set up a button so that it changes from a disabled to an active state when a certain condition is met. The condition is that at least two components (cards) need to be selected.

Currently, I’ve created two string variables: merge-button-state (with a default value of inactive) and card-state (with a default value of default). On each card, I’ve set an “on click” action to set card-state to “selected”, followed by the condition:

if card-state == "selected" 
  set merge-button-state to "active"

This works if I select just one card, but I want the button to become active only when at least two cards are selected.

I’ve also tried creating a variable for each card component, like card1-state and card2-state, but since it’s the same component, this approach doesn’t work.

Any idea how to achieve that?!

Hi there,

Thanks for reaching out. I might be misunderstanding, so could you share the current setup with some screenshots? Alternatively, could you provide a link to the file with access granted to support-share@figma.com? This won’t affect your billing. I’m hoping to investigate further.

Thanks,
Toku