drop down list

Hello,

Hope you all are safe and healthy!

I want to create a drop down like this…If I select baby the sub dropdown should show only baby products and so on…If i select Apparels it should show list related to apparels in subdrop down…Is it possible. If yes, please help.

The general concept for this is to give your first dropdown an onChange handler, which will then populate the options of the second dropdown based on the value selected in the first dropdown. See here for how to set the options of a dropdown.

Your dropdown options will need to be an array of key/value pairs, where the key is the name/label that you want to show on the page, and the value some unique identifier for that subcategory.

What you could do is create a series of simple collections, one for each subcategory. Each of these collections would have only a single field, being the name/label of the subcategory. You can use the default “Title” field for this. Each entry will then get an auto-generated ID (accessible in code with item._id), which you can use as the value for your dropdown options. The benefit of doing it this way is that, if you write your code to always pull the subcategories from these collections, any changes you make to the subcategories in the collections will automatically propagate through your site wherever they are referenced.