import panel as pn
pn.extension()
The RadioButtonGroup
widget allows selecting from a list or dictionary of values using a set of toggle buttons. It falls into the broad category of single-value, option-selection widgets that provide a compatible API and include the RadioBoxGroup
, Select
, and DiscreteSlider
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.
For layout and styling related parameters see the customization user guide.
options
(list or dict): A list or dictionary of options to select fromvalue
(object): The current value; must be one of the option valuesbutton_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 editablename
(str): The title of the widgetradio_group = pn.widgets.RadioButtonGroup(
name='Radio Button Group', options=['Biology', 'Chemistry', 'Physics'], button_type='success')
radio_group
Like most other widgets, RadioButtonGroup
has a value parameter that can be accessed or set:
radio_group.value
The RadioButtonGroup
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(radio_group.controls(jslink=True), radio_group)