MDN wants to learn about developers like you:

この翻訳は不完全です。英語から この記事を翻訳 してください。



HTMLの menuitem 要素( <menuitem>) は、ユーザがポップアップメニュから実行できるコマンドをあらわします。This includes context menus, as well as menus that might be attached to a menu 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. (Menu items for indirect commands gain checkboxes or radio buttons when defined against elements <input type="checkbox"> and <input type="radio">.)

コンテンツカテゴリ なし。
許可された内容 なし。これは空要素です。
タグの省略 開始タグが必須で、終了タグはあってはいけません。
許可された親要素 The <menu> element, where that element is in the popup menu state. (If specified, the type attribute of the <menu> element must be popup; if missing, the parent element of the <menu> must itself be a <menu> in the popup menu state.)
DOM インターフェース HTMLMenuItemElement



Specifies the ID of a separate element, indicating a command to be invoked indirectly. May not be used within a menu item that also includes the attributes checked, disabled, icon, label, radiogroup or type.
This Boolean attribute indicates use of the same command as the menu's subject element (such as a button or input).
Boolean attribute which indicates that the command is not available in the current state. Note that disabled is distinct from hidden; the disabled attribute is appropriate in any context where a change in circumstances might render the command relevant.
Image URL, used to provide a picture to represent the command.
The name of the command as shown to the user. Required when a command attribute is not present.
This attribute specifies the name of a group of commands to be toggled as radio buttons when selected. May only be used where the type attribute is radio.
This attribute indicates the kind of command, and can be one of three values.
  • command: A regular command with an associated action. This is the missing value default.
  • checkbox: Represents a command that can be toggled between two different states.
  • radio: Represent one selection from a group of commands that can be toggled as radio buttons.


HTML content

<!-- A <div> element with a context menu -->
<div contextmenu="popup-menu">
  Right-click to see the adjusted context menu

<menu type="context" id="popup-menu">
  <menuitem type="checkbox" onclick="toggleOption()" checked="true">Checkbox</menuitem>
  <menuitem type="command" label="Command" icon="icon.png" onclick="doSomething()">Checkbox</menuitem>
  <menuitem type="radio" name="group1" onclick="option()" checked="true">Radio button 1</menuitem>
  <menuitem type="radio" name="group1" onclick="option()">Radio button 2</menuitem>

CSS content

div {
  width: 300px;
  height: 80px;
  background-color: lightgreen;



Specification Status Comment
WHATWG HTML Living Standard
<menuitem> の定義
<menuitem> の定義
草案 Initial definition


機能 Chrome Firefox (Gecko) Internet Explorer Edge Opera Safari
基本サポート (有)[1] 8 (8)[2] 未サポート 未サポート (有)[3] ?
機能 Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
基本サポート 未サポート 8.0 (8) 未サポート 未サポート 未サポート

[1] This is implemented behind the preference Experimental Web Platform features and only supports type="command".

[2] Only works for <menuitems> defined within a <menu> element assigned to an element via the contextmenu attribute. Furthermore, the element requires a closing tag.

[3] This is implemented behind the preference Enable experimental Web Platform features and only supports type="command".

See also


 このページの貢献者: hamasaki, yuji38kwmt
 最終更新者: hamasaki,