Skip to main content

MultiDropdown

selectors.MultiDropdown

Creates a Dropdown multiple selector. Selection is limited to a predefined list of options.

ParameterDescriptionDefault
selector_nameThe name of the selector. It must be unique.-
optionsOptions available for this selector.-
options_namesHuman readable counterpart of options. It will be str(options) if not defined.-
labelThe label for the selector. If not passed, the selector shows its selector_name.-
default_valuesIf selected option is invalid or not defined, use this value.-
ignore_user_inputIf passed True, picks default_value instead of the selected value.False
run_on_changeIf passed True, the selector will not have an 'Apply' action and will trigger execution on change.False
placeholderShort hint displayed in the input field before the user enters a value.-
help_textTooltip help message displayed while the input is focused.-
widthCustom selector width.-
isDisableddisable this selector.False
block_uuidOptional value to specify the block that will be executed when the triggers execution.(current block uuid)

Examples:

sel = selectors.MultiDropdown("mdropdown_0", options=['apple', 'pear'], options_names=['Apple', 'Pear'], label='Select multiple values')
sel.render()
print("You have selected", sel.value)
from IPython.display import display, HTML
elements =[]

options = ['foo', 'bar', 'zoooo', 'zaaa aa aar']

dropdown = selectors.MultiDropdown(
'dropdown-1-multi',
options=options,
label='Multidropdown with helptext',
help_text='Custom help message',
)
elements.append(dropdown)

dropdown = selectors.MultiDropdown(
'dropdown-2-multi',
options=options,
label='Multidropdown with placeholder',
placeholder='Custom help message',
)
elements.append(dropdown)

dropdown = selectors.MultiDropdown(
'dropdown-3-multi',
options=options,
run_on_change=True,
label='Multidropdown run on change',
help_text='Custom help message',
)
elements.append(dropdown)

elements_html = "".join(
f'<tr><td>{element}</td><td>{element.value}</td></tr>'
for element in elements
)

display(HTML(f"""
<table>
<td></td><td>clicked</td>
{elements_html}
</table>
"""))

See also

  • Dropdown — the single-selection variant of this control.
  • All selector types — the full catalog of available selector controls.
  • Selectors — common arguments and how to define, render, and read selectors.