CrossSelector#
Download this notebook from GitHub (right-click to download).
import panel as pn
import panel_material_ui as pmui
pn.extension()
The CrossSelector 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, CheckBoxGroup and CheckButtonGroup widgets.
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 editableoptions(list or dict): List or dictionary of optionssearchable(boolean): Whether to render a search box.value(list): Currently selected option values
Display#
color(str): The color variant of the inputs, which must be one of'default'(white),'primary'(blue),'success'(green),'info'(yellow),'light'(light), or'danger'(red).label(str): The title of the widget
Styling#
sx(dict): Component level styling API.theme_config(dict): Theming API.
Aliases#
For compatibility with Panel certain parameters are allowed as aliases:
name: Alias forlabel
Basic Usage#
The CrossSelector provides a convenient API for selecting from multiple options:
cross_select = pmui.CrossSelector(label='CrossSelector', value=['Apple', 'Pear'],
options=['Apple', 'Banana', 'Pear', 'Strawberry'])
cross_select
CrossSelector.value returns a list of the currently selected options:
cross_select.value
Searchable#
You can also disable the search field in the selector by setting searchable=False:
pmui.CrossSelector(label='Age', options=['Ten', 'Twenty', 'Thirty'], searchable=False)
Colors#
pn.FlexBox(*[pmui.CrossSelector(
label=color, value=['Apple', 'Pear'], options=['Apple', 'Banana', 'Pear', 'Strawberry'], color=color
) for color in pmui.CrossSelector.param.color.objects])
Disabled & Loading#
Like all widgets the CrossSelector supports disabled and loading states:
pmui.CrossSelector(label='Ages', options=['Ten', 'Twenty', 'Thirty'], disabled=True, loading=True)
API Reference#
Parameters#
The CrossSelector widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:
pmui.CrossSelector(
label='CrossSelector', value=['Apple', 'Pear'],
options=['Apple', 'Banana', 'Pear', 'Strawberry']
).api(jslink=True)
References#
Panel Documentation:
How-to guides on interactivity - Learn how to add interactivity to your applications using widgets
Setting up callbacks and links - Connect parameters between components and create reactive interfaces
Declarative UIs with Param - Build parameter-driven applications
Material UI Transfer List:
Material UI Transfer List Reference - Complete documentation for the underlying Material UI component
Download this notebook from GitHub (right-click to download).