The HTML <menuitem>
tag represents a command that the user can invoke from a popup menu (either a context menu or the menu of a menu button).
You can use one or more type
, label
, icon
, disabled
, checked
, and radiogroup
attributes to set a new command. Otherwise you can use the command
attribute to reference another command. This way, you can define a command once, set its state (e.g. whether it is active or disabled) in one place, and have all references to that command in the user interface change at the same time.
The <menuitem>
tag is written as <menuitem>
(no end tag) with its contents inserted between the start and end tags. The tag can have any number of attributes, which are inserted into the start tag.
The <menuitem>
tag must be a child of a <menu>
element whose type
attribute is in the popup menu
state.
Like this:
<menu type="popup">
<menuitem label="" onclick="">
<menuitem label="" onclick="">
<menuitem label="" onclick="">
</menu>
The <menuitem>
tag is not supported in HTML 4.
The <menuitem>
tag is not actually supported in the first version of HTML5 either. It is supported in HTML 5.1 and the WHATWG HTML Living Standard.
For more information on this element, see HTML5 <menuitem>
Tag. Also check out the links to the official specifications below.