MultiDropdown
selectors.MultiDropdown
Creates a Dropdown multiple selector. Selection is limited to a predefined list of options.
| Parameter | Description | Default |
|---|---|---|
| selector_name | The name of the selector. It must be unique. | - |
| options | Options available for this selector. | - |
| options_names | Human readable counterpart of options. It will be str(options) if not defined. | - |
| label | The label for the selector. If not passed, the selector shows its selector_name. | - |
| default_values | If selected option is invalid or not defined, use this value. | - |
| ignore_user_input | If passed True, picks default_value instead of the selected value. | False |
| run_on_change | If passed True, the selector will not have an 'Apply' action and will trigger execution on change. | False |
| placeholder | Short hint displayed in the input field before the user enters a value. | - |
| help_text | Tooltip help message displayed while the input is focused. | - |
| width | Custom selector width. | - |
| isDisabled | disable this selector. | False |
| block_uuid | Optional 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.