import panel as pn pn.extension()
CrossSelector widget allows selecting multiple values from a list of options by moving items between two lists. It falls into the broad category of multi-option selection widgets that provide a compatible API and include the
For layout and styling related parameters see the customization user guide.
definition_order(boolean, default=True): Whether to preserve definition order after filtering. Disable to allow the order of selection to define the order of the selected list.
filter_fn(function): The filter function applied when querying using the text fields, defaults to re.search. Function is two arguments, the query or pattern and the item label.
options(list or dict): List or dictionary of available options
value(boolean): Currently selected options
disabled(boolean): Whether the widget is editable
name(str): The title of the widget
CrossSelector is made up of a number of components:
Two lists for the unselected (left) and selected (right) option values
Filter boxes that allow using a regex to match options in the list of values below
Buttons to move values from the unselected to the selected list (
>>) and vice versa (
cross_selector = pn.widgets.CrossSelector(name='Fruits', value=['Apple', 'Pear'], options=['Apple', 'Banana', 'Pear', 'Strawberry']) cross_selector
CrossSelector.value returns a list of the currently selected options: