Hello @vedantsane and welcome!
You can do that using this:
app.layout = html.Div(
[
dbc.Label("Choose one"),
dbc.RadioItems(
options=[
{"label": "Option 1", "value": 1},
{"label": "Option 2", "value": 2},
{"label": "Disabled Option", "value": 3},
],
value=1,
id="radioitems-input",
),
dcc.Dropdown(['NYC', 'MTL', 'SF'], 'NYC', id='1-dpdn'),
dcc.Dropdown(['NYC2', 'MTL2', 'SF2'], 'NYC2', id='2-dpdn'),
dcc.Dropdown(['NYC3', 'MTL3', 'SF3'], 'NYC3', id='3-dpdn'),
]
)
@app.callback(
[
Output('1-dpdn', 'disabled'),
Output('2-dpdn', 'disabled'),
Output('3-dpdn', 'disabled'),
],
[
Input("radioitems-input", "value")
],
)
def update_sidebar(unit):
if unit == 1:
return False, True, True
elif unit == 2:
return True, False, True
elif unit == 3:
return True, True, True```
Alternatively you can hide the dropdown
@app.callback(
[
Output('1-dpdn', 'style'),
Output('2-dpdn', 'style'),
Output('3-dpdn', 'style'),
],
[
Input("radioitems-input", "value")
],
)
def update_sidebar(unit):
if unit == 1:
return {'display': 'block'}, {'display': 'none'}, {'display': 'none'}
elif unit == 2:
return {'display': 'none'}, {'display': 'block'}, {'display': 'none'}
elif unit == 3:
return {'display': 'none'}, {'display': 'none'}, {'display': 'block'}