I am also interested in building nested drop downs, I'm getting cyclical dependencies when doing this at the moment. I'm using a polars df that contains the unique combination across several fields and then filtering the options of each multiselect box based on the previous one:
entity = mo.ui.multiselect(
options["entity_id"].unique().sort(),
label="entity"
)
category = mo.ui.multiselect(
options.filter(
pl.col('entity_id').is_in(entity.value) if entity.value else True
)["category"].unique().sort(),
label="cat"
)
subcategory = mo.ui.multiselect(
options.filter(
(pl.col('entity_id').is_in(entity.value) if entity.value else True) &
(pl.col('category').is_in(category.value) if category.value else True)
)["subcategory"].unique().sort(),
label="subcat"
)
mo.vstack([entity, category, subcategory, segment])