Skip to main content
Ctrl+K
Panel Material UI v0.0.1b13 - Home Panel Material UI v0.0.1b13 - Home
  • Component Gallery
  • Customization
  • Custom Components
  • GitHub
  • Twitter
  • Discourse
  • Discord
  • Component Gallery
  • Customization
  • Custom Components
  • GitHub
  • Twitter
  • Discourse
  • Discord

FOR USERS

  • Component Gallery
    • Widgets
      • AutocompleteInput
      • Button
      • CheckBoxGroup
      • CheckButtonGroup
      • Checkbox
      • ColorPicker
      • DatePicker
      • DateRangeSlider
      • DateSlider
      • DatetimePicker
      • DatetimeRangeSlider
      • DatetimeSlider
      • DiscreteSlider
      • EditableFloatSlider
      • EditableIntSlider
      • Fab
      • FileDownload
      • FileInput
      • FloatInput
      • FloatSlider
      • IconButton
      • IntInput
      • IntRangeSlider
      • IntSlider
      • MultiChoice
      • MultiSelect
      • NestedSelect
      • PasswordInput
      • RadioBoxGroup
      • RadioButtonGroup
      • RangeSlider
      • Select
      • Switch
      • TextAreaInput
      • TextInput
      • TimePicker
      • Toggle
      • ToggleIcon
    • Menus
      • Breadcrumbs
      • List
      • MenuButton
      • Pagination
      • SpeedDial
    • Layouts
      • Accordion
      • Backdrop
      • Card
      • Container
      • Dialog
      • Drawer
      • FlexBox
      • Grid
      • Paper
      • Tabs
    • Page
      • BreakpointSwitcher
      • Manual
      • Page
    • Chat
      • ChatAreaInput
      • ChatFeed
      • ChatInterface
      • ChatMessage
      • ChatStep
    • Indicators
      • LoadingSpinner
      • Progress
    • Global
      • Notifications
  • Customization
    • How to Customize
    • Palette
    • Typography
    • Themed Components
    • Dark Mode
    • Color
    • Icons
    • Bokeh, hvPlot, and HoloViews
  • Custom Components
HoloViz.org
  • hvPlot
  • HoloViews
  • GeoViews
  • Datashader
  • Param
  • Lumen
  • Colorcet

  • Examples Gallery
  • Blog
  • Component Gallery
  • Menus
  • MenuButton

MenuButton#

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


import panel as pn
import panel_material_ui as pmui

pn.extension()

The MenuButton component is part of the Menu family of components. Menu components provide a structured way for users to navigate or choose between a series of defined items. In the case of MenuItem, these items represent a series of actions to select from after opening the menu on a button click.

Each item in the MenuButton list is defined by a dictionary with several supported keys:

Item Structure#

Each item can include the following keys:

  • label (str, required): The text displayed for the breadcrumb item.

  • href (str, optional): A URL to link to. If provided, the breadcrumb becomes a link.

  • icon (str, optional): An icon to display next to the label.

  • avatar (str, optional): An avatar or image to show beside the label.

These dictionaries are passed to the component via the items parameter as a list. When one of the items is selected it will be available on the value parameter.

Since only the allowed keys are synced with the frontend, other information can be stored in the item dictionaries.

Parameters:#

Core#

  • active (boolean): Whether the dialog is visible.

  • disabled (boolean): Whether the button is clickable.

  • items (list): Menu items to select from.

  • value (dict): The currently selected item.

Display#

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

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

  • icon (str): An icon to render to the left of the button label. Either an SVG or an icon name which is loaded from Material UI Icons.

  • icon_size (str): Size of the icon as a string, e.g. 12px or 1em.

  • label (str): The title of the widget.

  • variant (str): The button style, either ‘solid’, ‘outlined’, ‘text’.

Styling#

  • sx (dict): Component level styling API.

  • theme_config (dict): Theming API.


MenuButton allows selecting between a number of items:

menu_button = pmui.MenuButton(items=[
    {'label': 'Open', 'icon': 'description'},
    {'label': 'Save', 'icon': 'save'},
    {'label': 'Exit', 'icon': 'close'},
], label='File', icon='storage')

menu_button

The MenuButton also allows separating options into groups by adding a None in between:

pmui.MenuButton(label="File", icon="save", items=[
    {"label": "License", "icon": "law"},
    None,
    {"label": "About", "icon": "info"}
])
pn.Row(
    pmui.MenuButton(name="File", icon="save", items=[
        {"label": "License", "icon": "law"},
        None,
        {"label": "About", "icon": "info"}
        
    ]),
    pmui.MenuButton(name="Help", icon='help', items=[
        {"label": "Save", "icon": "law"},
        {"label": "Exit", "icon": "info"}        
    ]) 
)

Display Options#

color#

pn.GridBox(*(
    menu_button.clone(color=color)
    for color in pmui.MenuButton.param.color.objects
), ncols=2)

variant#

pn.Row(*(
    menu_button.clone(variant=variant)
    for variant in pmui.MenuButton.param.variant.objects
))

Controls#

The MenuButton menu exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:

pn.Row(menu_button.controls(jslink=True), menu_button)

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

previous

List

next

Pagination

On this page
  • Item Structure
  • Parameters:
    • Core
      • Display
      • Styling
    • Display Options
      • color
      • variant
    • Controls

© Copyright 2024-2025 Holoviz contributors.

Created using Sphinx 8.2.3.

Built with the PyData Sphinx Theme 0.16.1.