HTML Tags

HTML5 <menuitem> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <menuitem> element defines a list (or menuitem) of commands that a user can perform.

The following table summarizes the usages context and the version history of this tag.

Permitted Parent: <menu>
Content: None. It is an empty element.
Start/End Tag: Start tag: required, End tag: forbidden
Version: New in HTML5

Syntax

The basic syntax of the <menuitem> tag is given with:

HTML: <menuitem>; XHTML: <menuitem />

The example below shows the <menuitem> tag in action.

  • <img src="sky.jpg" id="sky" width="250" alt="Cloudy Sky" contextmenu="skymenu">
  • <menu type="context" id="skymenu">
  •     <menuitem label="Zoom In" icon="zoom-in.png" onclick="zoomin()">
  •     <menuitem label="Zoom Out" icon="zoom-out.png" onclick="zoomout()">
  •     <menuitem label="Reload Image" icon="reload.png" onclick="window.location.reload();">
  • </menu>

Warning: Currently the <menuitem> tag is not supported by the most of the web browsers like Chrome, IE, Safari, etc. Better you should avoid using this tag.


Tag-Specific Attributes

The following table shows the attributes that are specific to the <menuitem> tag.

Attribute Value Description
Required — The following attribute must be specified on this tag for the markup to be valid.
label text Specifies the name of the command/menu item, as shown to the user.
Optional — The following attributes are optional.
checked checked This Boolean attribute specifies that whether the command or menu item is selected when the page loads.
command ID Specifies the ID of a separate element, indicating a command to be invoked indirectly.
default default This Boolean attribute specifies the command/menu item as being a default command.
disabled disabled This Boolean attribute which indicates that the command is disabled and not available in the current state.
icon URL Specifies an icon for the command/menu item.
radiogroup group-name Specifies the name of a group of commands to be toggled as radio buttons when selected. Only be used where the type attribute is radio.
type checkbox
command
radio
Specifies the type of command/menu item. The default value of this attribute is command.

Global Attributes

Like all other HTML tags, the <menuitem> tag supports the global attributes in HTML5.


Event Attributes

The <menuitem> tag also supports the event attributes in HTML5.


Browser Compatibility

The <menuitem> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 8+ (only context menu)
  • Google Chrome ×
  • Internet Explorer ×
  • Apple Safari ×
  • Opera ×

Further Reading

See tutorial on: HTML Lists.

Related tags: <ol>, <ul>, <li>.

Your Feedback:

We would love to hear from you, please drop us a line.