Exploring Additional Features of Drop-Downs

Get familiar with the commonly used features of drop-down components using the Dash Core Components package.

The Dropdown component has an optional parameter, multi, that takes a boolean argument, which we can set to True to allow this.

dcc.Dropdown(id='gini_country_dropdown',
multi=True,
options=[{'label': country, 'value': country}
    for country in gini_df['Country Name'].unique()]),

We can now make the changes and use the Gini country bar chart for as many countries as we like. The height of that figure on the page dynamically expands/collapses based on the dynamic height that we set, so we also don’t need to worry about this aspect of the layout. The users will manage it themselves while interacting with the components.

Let’s now see whether it’s easy for a newcomer to use those options.

Adding placeholder text to drop-downs

If we look at the Gini index section of the app for the first time, we will see two drop-downs that allow us to make a selection, as shown in the illustration below:

Get hands-on with 1200+ tech skills courses.