📦 dash_dropdown_components
Custom dropdown components for Plotly Dash similar to dcc.Dropdown, offering advanced functionality such as nested options and improved multi-select behavior.
📥 Installation
pip install dash-dropdown-components
Showcase
🧩 Components
🔽 Dropdown
A customizable dropdown component that enhances the standard Dash dropdown with additional features.
✅ Features
- Emulates dcc.Dropdown - Drop-in replacement for most use cases.
- Stays open on select – When
multi=True, the dropdown stays open after selection (unlikedcc.Dropdown). - Smart multi→single behavior
– When switching
multi=Truetomulti=Falsedynamically, the first selected item is automatically preserved—no need for callbacks. – Clearable formulti=Trueand not clearable formulti=Falseby default, or control usingclearableoption. - Multi-select support – Supports selecting multiple items.
- Searchable – Optionally enable a search term.
⚙️ Properties
| Property | Type | Description |
|---|---|---|
id |
string |
Unique component ID |
options |
list[dict,str] |
List of options with label and value keys, or list with values |
value |
string or list |
Selected value(s) |
multi |
bool |
Enable multiple selections |
searchable |
bool |
Enables search |
clearable |
bool |
Whether or not the dropdown is "clearable", that is, whether or not a small "x" appears on the right of the dropdown that removes the selected value. |
placeholder |
string |
Placeholder text when nothing is selected |
disabled |
bool |
If True, this dropdown is disabled and the selection cannot be changed. |
hide_options_on_select |
bool |
If True, options are removed when selected |
style |
dict |
Inline CSS styles applied to the dropdown container |
className |
string |
Optional CSS class for styling |
🌲 MultiLevelDropdown
A hierarchical dropdown component that supports nested options (multilevel structure), allowing for structured category selection.
✅ Features
- Nested options – Supports arbitrarily nested dropdowns.
- Expandable submenus – Submenus open and close interactively.
- Custom labels – Each level supports custom labeling and values.
⚙️ Properties
| Property | Type | Description |
|---|---|---|
id |
string |
Unique component ID |
options |
list[dict,str] |
List of dicts of options with label, value and optional nested options keys (recursive) |
value |
string or list |
Selected value(s) |
multi |
bool |
Enable multiple selections |
clearable |
bool |
Whether or not the dropdown is "clearable", that is, whether or not a small "x" appears on the right of the dropdown that removes the selected value. |
placeholder |
string |
Placeholder text when nothing is selected |
disabled |
bool |
If True, this dropdown is disabled and the selection cannot be changed. |
hide_options_on_select |
bool |
If True, options are removed when selected |
submenu_widths |
list |
Control the width of the submenu for each level. Can be in percentage of the preceding level or fixed widths |
submenu_max_width |
string/number/list |
Maximum width of submenus, so they don't grow too wide when labels are long; long labels wrap within this width. Defaults to the dropdown control's width. A single CSS width for all levels (e.g. '300px', '25vw', a number as px, or 'none' to disable), or a list for per-level control. |
style |
dict |
Inline CSS styles applied to the dropdown container |
className |
string |
Optional CSS class for styling |
💡 Usage Example
import dash_dropdown_components as ddc
from dash import Dash, callback, html, Input, Output, dcc
app = Dash(__name__)
options = [
{'value': 'banana', 'label': 'Banana'},
{'value': 'apple', 'label': 'Apple'},
{'value': 'strawberry', 'label': 'Strawberry'},
{'value': 'kiwi', 'label': 'Kiwi'},
{'value': 'orange', 'label': 'Orange'},
{'value': 'blueberry', 'label': 'Blueberry'},
{'value': 'lemon', 'label': 'Lemon'},
{'value': 'lime', 'label': 'Lime'},
{'value': 'mandarin', 'label': 'Mandarin'},
]
multi_level_options = [
{
'label': 'Fruits',
'value': 'fruits',
'options': [
{ 'label': 'Apple', 'value': 'apple' },
{ 'label': 'Banana', 'value': 'banana' },
{ 'label': 'Berries',
'value': 'berries',
'options': [
{ 'label': 'Strawberry', 'value': 'strawberry'},
{ 'label': 'Blueberry', 'value': 'blueberry'}
]
}
]},
{
'label': 'Vegetables',
'value': 'vegetables',
'options': [
{
'label': 'Potato',
'value': 'potato'
},
{
'label': 'Carrot',
'value': 'carrot'
},
]}
];
app.layout = html.Div(
[
html.Div([
html.P('ddc.Dropdown'),
dcc.RadioItems(id='ddc-dd-multi',
options=[{'label': 'Multi: True', 'value': True},
{'label': 'Multi: False', 'value': False}],
value=False),
ddc.Dropdown(
id='ddc-dd',
options=options,
value=options[0]['value'],
multi=False,
disabled=False,
searchable=True,
hide_options_on_select=True
),
html.Div(id='ddc-dd-selection')
], style={'width': '25%', 'display': 'inline-block'}),
html.Div([
html.P('ddc.MultiLevelDropdown'),
dcc.RadioItems(id='ddc-mldd-multi',
options=[{'label': 'Multi: True', 'value': True},
{'label': 'Multi: False', 'value': False}],
value=False),
ddc.MultiLevelDropdown(
id='ddc-mldd',
options=multi_level_options,
value=['fruits', 'banana'],
multi=False,
disabled=False,
hide_options_on_select=True,
submenu_widths=['10vw', '20vw']
),
html.Div(id='ddc-mldd-selection')
], style={'width': '25%', 'display': 'inline-block'}),
],
style={'display': 'flex', 'flexDirection': 'row'})
@callback(Output('ddc-dd-selection', 'children'),
Input('ddc-dd', 'value'))
def display_output(value):
return 'You have entered {}'.format(value)
@callback(Output('ddc-mldd-selection', 'children'),
Input('ddc-mldd', 'value'))
def display_output(value):
return 'You have entered {}'.format(value)
@callback(Output('ddc-dd', 'multi'),
Input('ddc-dd-multi', 'value'))
def set_multi(multi):
return multi
@callback(Output('ddc-mldd', 'multi'),
Input('ddc-mldd-multi', 'value'))
def set_multi(multi):
return multi
if __name__ == '__main__':
app.run(debug=True)
📝 License
This project is licensed under the MIT License. See the LICENSE file for details.
🔗 Links
Metadata
Release files for dash-dropdown-components 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dash_dropdown_components-1.1.2.tar.gz | 636.2 kB | Without provenance | Details for dash_dropdown_components-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dash_dropdown_components-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for dash_dropdown_components-1.1.2-py3-none-any.whl |
Total release size: 1.3 MB
Release files / dash_dropdown_components-1.1.2.tar.gz
| Download URL | dash_dropdown_components-1.1.2.tar.gz |
|---|---|
| Size | 636.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecdfca538e2365465643a60630fa0c650f9afb455870a5df0285b0551d0321ae
|
|
BLAKE2b-256 checksum How to use checksums |
1454afd14fa25aaa6e920f9a7bf426c3d58ea9be90f3d32b394f2a2a7c00be69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / dash_dropdown_components-1.1.2-py3-none-any.whl
| Download URL | dash_dropdown_components-1.1.2-py3-none-any.whl |
|---|---|
| Size | 639.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b8ec82b2655d522bdf95ae3c3a8dddcc2b3d868c13c9b6300da2b1f10fe77f2
|
|
BLAKE2b-256 checksum How to use checksums |
d4e155fe1ebf930b35b9d00f36a6b1692a2acc128804805ee369d4f708546889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for dash-dropdown-components 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.