How to create multiple dropdown menus in a frame

Hello all,

New to Figma and have a question about dropdown menus. I’m trying to create a Your Cart screen that will have a dropdown menu allowing users to change the quantity of each line item in the cart. I can do it, but the problem is that it’s possible to have multiple dropdowns open at the same time currently.

For example, if you click on the qty selector for line item 1, it opens the dropdown. But if instead of selecting a qty, the user then clicks on the qty selector for line 2, both dropdowns are open at the same time. I need the first dropdown to close if they dont select a qty. I tried using an overlay but then it will revert the select quantity back to 1 when the overlay closes.

Here’s a screenshot of what happens if you click the qty selector for all 3 line items without selecting a qty on any of them.

I will start by saying what you’re asking to do is technically possible. However, I want to caution you that 1) it is extremely tedious and time consuming to do this and 2) you have to set up your component with the maximum number of drop-downs you will need at the beginning.

The only way I was able to create the scenario you’re describing is by creating a master component that included every possible state for every drop-down list and selection combination.

I started by creating a drop-down, then creating a product line item, and then finally creating a product table that contained 3 products. I then created duplicates of that frame where each product could have the drop down set to an array between 1-3. But because there are 3 products with 3 selections, this maths out to be 3x3x3=27 possibilities.

Then I created a variation where each of those combinations could have the drop-down menu open or closed, which means that there’s 4 additional states a menu could be in: closed, open with 1 selected, open with 2 selected, and open with 3 selected. So 27x4=108 total versions of this single product table where there were 3 products that could have a quantity between 1-3.

At this point, I painstakingly renamed all my frames so it followed the naming conventions to support multiple properties. The naming convention I used was Product Table / Product A # / Product B # / Product C # / State. Where there is a #, this could be 1-3. And State could be Closed, 1 Selected, 2 Selected, or 3 Selected (this supports the opening of the drop-down list, otherwise you’re just changing the # inside the closed drop-down list…see above paragraph). I selected all 108 versions, and converted it to a component set. If you convert it all into a component before renaming your frames, you’ll have many regrets. Don’t skip.

AND THEN you have to tediously add each of the interactions.

For a version of the product table where all of the drop-downs are closed (of which there are 27 versions), you have to create an interaction for “On Click” > Change To > (the open version of whatever state you’re currently using). This part was pretty fast, even for 27 of them. You’ll have to do this X times, where X is equal to your total number of products in your product table.

For a version of the product table where a drop-down menu is open (of which there are 81 versions), you’ll have to add an interaction on the currently selected number to go back to the closed state (otherwise, there’s no way to close the drop-down without making a new selection). You’ll also have to add an interaction for each possible numerical selection. Because my drop-down only supported a quantity between 1-3, that means a total of 4 interactions each time. I should remind you that you have to select that specific line item each time, then set the parameters exactly for that selection.

This is where I gave up. It’s extremely tedious and time consuming, which is why I don’t have an example to share. If I was to do this again, I would create a product table with 2 products that could have a quantity between 1-2 (12 variations vs. 108). Oops.

So, quick math. For my prototype, I would have needed to make this many interactions:

405 interactions to build a product table with 3 products that could have a quantity between 1-3!! I shudder to think how upping the quantity to 5 like in your example would affect the numbers. I hate math, so I’ll let someone else do the number crunching.

Needless to say, it’s an extremely time-consuming task, and I absolutely would not recommend building this out unless the client/stakeholder absolutely insists on it. And even then, I would emphasize the amount of effort such a requirement would have on your build time and suggest ways to accomplish the goal of the prototype without implementing this solution.

If you’re trying to build your prototype to conduct usability testing, I highly recommend you simply phrase your test question to push a user to change the quantity for a single item. For example, “Please show what you would do if you wanted to purchase two [products].” You don’t need to provide test participants with every possible action in order to determine viability of a product or feature.

Hope this helps!

Edit: Had to adjust my formulas to use x rather than an asterisk to represent multiplication because it was adding italics styling.

Ok, I lied. I did the math.

If you want 3 products that could have a quantity between 1-5, it would require you to make 750 different variations for your component. Yikes.

I’m less certain about this math, but I’m fairly certain you would need to add 4,125 interactions to build the interactivity properly. Don’t do it…

Thank you so much for the detailed explanation. I did not realize it was such a complicated process (Figma beginner), but it is good to know that I’m not missing something obvious and that it’s not truly necessary to build that out for the prototype. I will practice your steps though and make sure I know how to do this in case I need to utilize it.

This was my first question on the Figma community and it is nice to know there is such detailed support for beginners so once again, thank you very very much.

1 Like

Made dropdown with variables