Skip to main content
Question

Getting dynamic text from a multi-select component

  • May 2, 2024
  • 1 reply
  • 399 views

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

  1. Checking one item will set its boolean to true
  2. The selection string will check for which boolean(s) are true
  3. 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?

This topic has been closed for comments

1 reply

Vishal_Ramawat

You can check out the responses in this thread. It is similar discussion.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings