import panel as pn
pn.extension()
The MultiChoice
widget allows selecting multiple values from a list of options. It falls into the broad category of multi-value, option-selection widgets that provide a compatible API and include the MultiSelect
, CrossSelector
, CheckBoxGroup
and CheckButtonGroup
widgets. The MultiChoice
widget provides a much more compact UI than MultiSelect
.
For more information about listening to widget events and laying out widgets refer to the widgets user guide. Alternatively you can learn how to build GUIs by declaring parameters independently of any specific widgets in the param user guide. To express interactivity entirely using Javascript without the need for a Python server take a look at the links user guide.
For layout and styling related parameters see the customization user guide.
options
(list or dict): List or dictionary of optionsmax_items
(int): Maximum number of options that can be selectedvalue
(list): Currently selected option valuesdelete_button
(boolean): Whether to display a button to delete a selected optiondisabled
(boolean): Whether the widget is editablename
(str): The title of the widgetoption_limit
(int): Maximum number of options to display at once.placeholder
(str): String displayed when no selection has been made.solid
(boolean): Whether to display widget with solid or light style.multi_choice = pn.widgets.MultiChoice(name='MultiSelect', value=['Apple', 'Pear'],
options=['Apple', 'Banana', 'Pear', 'Strawberry'])
pn.Column(multi_choice, height=200)
MultiChoice.value
returns a list of the currently selected options:
multi_choice.value
The solid
option controls the style of the widget:
pn.Column(multi_choice.clone(solid=False), height=200)
The MultiChoice
widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:
pn.Row(multi_choice.controls(jslink=True), multi_choice)