v7.3.0

MenuItem

A widget representing a single menu item in a Menu. May be configured with a checked state which creates a checkbox which may be toggled. Can also be disabled, which affects item appearance and blocks interactions.

Fires events when activated which bubble up through the parent hierarchy and may be listened for on an ancestor. See Menu for more details on usage.

To add a border above a menu item, you can set separator to true. The separator is automatically hidden if the menu item is the first visible item in the menu.

This widget is not intended to be used directly

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • If provided, turns the menu item into a link

  • Set to true to display a border above this menu item, if there are other visible menu items before it.

  • target : '_self'/'_blank'/'_parent'/'_top'/null

    The target attribute for the href config

  • The text to be displayed in the item. The text is automatically HTML encoded.

    Has a corresponding runtime text property.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isMenuItem : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of MenuItem class, or subclass thereof.
  • menu : Widget
    READONLY

    Returns the instantiated menu widget as configured by menu.

    Has a corresponding menu config.

  • The text to be displayed in the item. The text is automatically HTML encoded.

    Has a corresponding text config.

  • isMenuItem : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of MenuItem class, or subclass thereof.

Functions

Functions are methods available for calling on the class
    • Actions this item. Fires the item event, and if this is a checked item, toggles the checked state, firing the toggle event.

    Events

    Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

    Event handlers

    Event handlers are callbacks called as a result of certain actions in this class

    CSS variables

    CSS variables that can be set to adjust appearance
    Name Description
    --b-menu-item-background Menu item background
    --b-menu-item-border-radius Menu item border radius
    --b-menu-item-color Menu item color
    --b-menu-item-font-weight Menu item font-weight
    --b-menu-item-gap Gap between menu item parts (icon, text, sub-menu icon)
    --b-menu-item-icon-color Color for menu item's icon
    --b-menu-item-icon-width Menu icon width, to make sure everything lines up nicely
    --b-menu-item-min-width Minimum width of a menu item
    --b-menu-item-padding Menu item padding
    --b-menu-item-separator-border-color Separator item color
    --b-menu-item-separator-height Height of the separator
    --b-menu-item-separator-inset Inset-inline for the separator
    Disabled
    --b-menu-item-disabled-color Color for disabled menu item
    --b-menu-item-disabled-icon-color Color for disabled menu item's icon
    Focused
    --b-menu-item-focus-background Background for focused menu item
    --b-menu-item-focus-color Color for menu item when focused
    --b-menu-item-focus-icon-color Color for menu item's icon when hovering the item
    Hovered
    --b-menu-item-hover-background Background for hovered menu item
    --b-menu-item-hover-color Color for menu item when hovering it
    --b-menu-item-hover-icon-color Color for menu item's icon when hovering the item
    type: menuitem

    Source path

    Core/widget/MenuItem.js

    Contents