CheckButtonGroup#

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


import panel as pn
import panel_material_ui as pmui

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.

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 (boolean): Currently selected options

Display#

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

  • description (str | Bokeh Tooltip | pn.widgets.TooltipIcon): A description which is shown when the widget is hovered.

  • label (str): The title of the widget

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

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 for variant

  • button_type: Alias for color

  • name: Alias for label


checkbutton_group = pmui.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']

Styles#

The color of the button can be set by selecting one of the available button_type values and the button_style can be 'solid' or 'outline':

pn.Row(
    *(pn.Column(*(
        pmui.CheckButtonGroup(
            label=color, color=color, variant=variant, options=['Foo', 'Bar', 'Baz'], value=['Bar']
        )
        for color in pmui.Button.param.color.objects
    ))
    for variant in pmui.Button.param.variant.objects)
)

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)

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