CheckButtonGroup#

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


import panel as pn
pn.extension()

The CheckButtonGroup widget allows selecting between a list of options by toggling the corresponding buttons. It falls into the broad category of multi-option selection widgets that provide a compatible API and include the MultiSelect, CrossSelector and CheckBoxGroup widgets.

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.

Parameters:#

For layout and styling related parameters see the customization user guide.

Core#

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

  • value (boolean): Currently selected options

Display#

  • button_type (str): A button theme should be one of 'default' (white), 'primary' (blue), 'success' (green), 'info' (yellow), or 'danger' (red)

  • disabled (boolean): Whether the widget is editable

  • name (str): The title of the widget

  • orientation (str, default=’horizontal’): Button group orientation, either ‘horizontal’ or ‘vertical’


checkbutton_group = pn.widgets.CheckButtonGroup(name='Check Button Group', value=['Apple', 'Pear'], options=['Apple', 'Banana', 'Pear', 'Strawberry'])

checkbutton_group

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

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

Controls#

The CheckButtonGroup 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(checkbutton_group.controls(jslink=True), checkbutton_group)
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

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