MultiChoice#
Download this notebook from GitHub (right-click to download).
import panel as pn
import panel_material_ui as pmui
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
.
Discover more on using widgets to add interactivity to your applications in the how-to guides on interactivity. Alternatively, learn how to set up callbacks and (JS-)links between parameters or how to use them as part of declarative UIs with Param.
Parameters:#
For details on other options for customizing the component see the customization guides.
Core#
disabled
(boolean): Whether the widget is editabledisabled_options
(list): List of options that are disabled.options
(list or dict): List or dictionary of optionsmax_items
(int): Maximum number of options that can be selectedsearchable
(boolean): Whether to render a search box.value
(list): Currently selected option values
Display#
bookmarks
(list): List of bookmarked options that are rendered first.delete_button
(boolean): Whether to display a button to delete a selected optiondropdown_height
(int | None): Height of the select dropdown.filter_on_search
(boolean): Whether to filter or highlight the matching options on search.label
(str): The title of the widgetoption_limit
(int): Maximum number of options to display at once.search_option_limit
(int): Maximum number of options to display at once if search string is entered.placeholder
(str): String displayed when no selection has been made.solid
(boolean): Whether to display widget with solid or light style.
Styling#
sx
(dict): Component level styling API.theme_config
(dict): Theming API.
Aliases#
For compatibility with Panel certain parameters are allowed as aliases:
button_style
: Alias forvariant
button_type
: Alias forcolor
name
: Alias forlabel
multi_choice = pmui.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)
Controls#
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)
Download this notebook from GitHub (right-click to download).