Skip to content

Instantly share code, notes, and snippets.

@techzeero
Created March 3, 2022 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techzeero/c157c0b952532ce5636a5bf84f0ed505 to your computer and use it in GitHub Desktop.
Save techzeero/c157c0b952532ce5636a5bf84f0ed505 to your computer and use it in GitHub Desktop.
Multi-Value Dropdown | Dash Plotly
from dash import Dash, dcc, html, Input, Output
app = Dash()
app.layout = html.Div([
dcc.Dropdown(
id='dropdown1' # Dropdown id
options=[{'label': 'India', 'value': 'India'},
{'label': 'Russia', 'value': 'Russia'},
{'label': 'USA', 'value': 'USA'}], # Data to be shown in dropdown options
value='India', # Dropdown Default Value
multi=True, # Multi-value Dropdown
),
html.Div(id='output-container')
])
@app.callback(Output('output-container', 'children'),
Input('dropdown1', 'value'))
def update_output(value):
return f'You have selected {value}'
if __name__ == '__main__':
app.run_server()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment