Created
March 3, 2022 14:13
-
-
Save techzeero/c157c0b952532ce5636a5bf84f0ed505 to your computer and use it in GitHub Desktop.
Multi-Value Dropdown | Dash Plotly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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