Skip to main content

MultiSelect

The MultiSelect component allows users to select multiple options from a list, providing a versatile solution for complex forms.

import dash
from dash import html
import yipit_dash_mui_components as dmc

dash._dash_renderer._set_react_version('18.2.0')

app = dash.Dash(__name__)

app.layout = dmc.YipitMUIProvider(
children=[
html.Div([
dmc.MultiSelect(
id="multi-select",
label="Choose options",
options=[
{"value": "option1", "label": "Option 1"},
{"value": "option2", "label": "Option 2"},
{"value": "option3", "label": "Option 3"},
],
selectedValues=["option1"]
),
html.Div(id="output")
])
]
)

@app.callback(
dash.Output("output", "children"),
dash.Input("multi-select", "selectedValues")
)
def update_output(selected_values):
return f"Selected values: {', '.join(selected_values)}"

if __name__ == "__main__":
app.run_server(debug=True)

Props Table

Below are the main props available for the MultiSelect component:

PropTypeDefaultDescription
idstringnullUnique ID for Dash callbacks.
labelstringnullLabel for the MultiSelect component.
optionsArray[]List of options to display.
selectedValuesstring[][]Selected values as an array.
onChangefunctionnullCallback triggered when the selection changes.
searchTextstringnullText input for searching options.
slotPropsstringnullThe props used for each slot inside.
limitTagsnumber-1The maximum number of tags that will be visible when not focused. Set -1 to disable the limit.