CheckBoxGroup#

Download this notebook from GitHub (right-click to download).


import panel as pn
import panel_material_ui as pmui

pn.extension()

The CheckBoxGroup widget allows selecting between a list of options by ticking the corresponding checkboxes. It falls into the broad category of multi-option selection widgets that provide a compatible API and include the MultiSelect, CrossSelector 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 editable

  • options (list or dict): List or dictionary of options

  • value (list): Currently selected options

Display#

  • inline (boolean): Whether to arrange the items vertically in a column (False) or horizontally in a line (True)

  • 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 for label


checkbox_group = pmui.CheckBoxGroup(
    label='Checkbox Group', value=['Apple', 'Pear'], options=['Apple', 'Banana', 'Pear', 'Strawberry'],
    inline=True)

checkbox_group

CheckBoxGroup.value returns a list of the currently selected options:

checkbox_group.value
['Apple', 'Pear']

Controls#

The CheckboxBoxGroup 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(checkbox_group.controls(jslink=True), checkbox_group)

Download this notebook from GitHub (right-click to download).