How to change the type of component dynamically?

I have an intricate selection drawer in my app and would like the type of selection components to update based on selected values. For example: If I have a dropdown with two options x and y, I would like a new dropdown to appear if I select x, and a new RadioItem to appear if I select y. Is there a way to dynamically update the type of a component in Dash?

I thought of having a html.Div() and then updating the children to either a dropdown or radioItem, but I haven’t had much luck. And advice on a solution would be appreciated.

Hi @lutherrichards,

One possible solution is that you can use the css property style={'display':'none} to hide and style={'display':'block} to unhide the dynamic components. You can update the style property values by checking the input x or y from the callback function.

1 Like