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

import panel as pn

The Select widget allows selecting a value from a list or dictionary of options by selecting it from a dropdown menu or selection area. It falls into the broad category of single-value, option-selection widgets that provide a compatible API and include the RadioBoxGroup, AutocompleteInput 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 from

  • disabled_options (list): Optional list of options that are disabled, i.e. unusable and un-clickable. If options is a dictionary the list items must be dictionary values.

  • groups (dict): A dictionary whose keys are used to visually group the options and whose values are either a list or a dictionary of options to select from. Mutually exclusive with options and valid only if size is 1.

  • size (int, default=1): Declares how many options are displayed at the same time. If set to 1 displays options as dropdown otherwise displays scrollable area.

  • value (object): The current value; must be one of the option values


  • disabled (boolean): Whether the widget is editable

  • name (str): The title of the widget

select = pn.widgets.Select(name='Select', options=['Biology', 'Chemistry', 'Physics'])


Like most other widgets, Select has a value parameter that can be accessed or set:


The options parameter also accepts a dictionary whose keys are going to be the labels of the dropdown menu.

select = pn.widgets.Select(name='Select', options={'Biology': 1, 'Chemistry': 2})


Updating the value will display the right label.

select.value = 2

A subset of the displayed items can be disabled with disabled_options. The widget value cannot be set to one of the disabled_options, either programmatrically or with the user interface.

select = pn.widgets.Select(name='Select', options=['Biology', 'Chemistry', 'Physics'], disabled_options=['Chemistry'])


The items displayed in the dropdown menu can be grouped visually (also known as optgroup) by setting the groups parameter instead of options. groups accepts a dictionary whose keys are used to group the options and whose values are defined similarly to how options are defined.

select = pn.widgets.Select(name='Select', groups={'Europe': ['Greece', 'France'], 'Africa': ['Algeria', 'Congo']})


Instead of a dropdown menu we can also select one option from a list by rendering multiple options at once using the size parameter:

select_area = pn.widgets.Select(name='Select', options=['Biology', 'Chemistry', 'Physics'], size=2)


When size is set to a value greater than 1 the widget supports the disabled_options parameter but does not support groups.

pn.widgets.Select(name='Select', options=['Biology', 'Chemistry', 'Physics'], size=2, disabled_options=['Chemistry'])


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