I am trying to design a reusable multi-select dropdown component, pictured here:
My goal is to get the “Select an item” text to dynamically update based on which checkbox components are in the “selected” state- my initial thought was to use variables to attach a boolean to each checkbox component, and then have the selection text either tied to those variables, or just brute forced thru a sort of switch statement based on what checkboxes are selected.
My ideal case would be a basic flow up where
- Checking one item will set its boolean to true
- The selection string will check for which boolean(s) are true
- The string will concatenate the boolean names that are set to true and display in the prototype
With the additional caveat (if possible) that there is a “select all” checkbox that would override all the individual selections and just set the selection string to “all items”
Is there a good way to do that in Figma as it exists today? Or is it just better to keep a simple version where the selections are just set by the designer and there is no dynamic adjustment?