The HTML5 <menuitem> element represents a command that a user is able to invoke through a popup menu (usually by clicking on the right button). A command can either be defined explicitly, with a textual label and optional icon to describe its appearance, or alternatively as an indirect command whose behavior is defined by a separate element. Commands can also optionally include a checkbox or be grouped to share radio buttons.

Syntax:

<menu><menuitem></menuitem><menuitem></menuitem></menu>

Attributes:

  • checked; Indicates whether the command is selected during page loading; it may only be used when the type attribute is checkbox or radio.
  • command; Specifies the ID of a separate element, indicating a command to be invoked indirectly; it may not be used within a menu item that also includes the attributes checked, disabled, icon, label, radiogroup or type
  • default; Indicates which command or menu item to be a default
  • disabled; Indicates that the command or menu item should be disabled
  • icon; Specifies the URL of an icon / picture that will represent the command or menu item
  • label; This attribute is required and used to specify the item's name shown to the user
  • radiogroup; Specifies the name of the group of commands or menu items that will be toggled when a button is selected (only for radio buttons)
  • type; Defines whether the item is a command or a menu item; the default is a command; this attribute may be:
    • checkbox; The command may be toggled as a checkbox
    • command; Default selection; Specifies a regular command as the action
    • radio; The command may be toggled as a radio button
  • global attributes
  • event attributes

Example

The menu tag example with menu items:

 

›› go to examples ››