Web/HTML/Element/command

From Get docs

ObsoleteThis feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.


The HTML Command element (<command>) represents a command which the user can invoke. Commands are often used as part of a context menu or toolbar. However, they can be used anywhere on the page.

The <command> element is included in the W3C specification, but not in the WHATWG specification, and browser support is nonexistent. You should use the <menuitem> element instead, although that element is non-standard and only supported in Edge and Firefox.


Content categories Flow content, phrasing content, metadata content.
Permitted content None, it is an empty element.
Tag omission The start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden.
Permitted parent elements <colgroup> only, though it can be implicitly defined as its start tag is not mandatory. The <colgroup> must not have a <span> as child.
DOM interface HTMLCommandElement

Attributes

This element includes the global attributes.

checked
Indicates whether the command is selected. Must be omitted unless the type attribute is checkbox or radio.
disabled
Indicates that the command is not available.
icon
Gives a picture which represents the command.
label
The name of the command as shown to the user.
radiogroup
This attribute gives the name of the group of commands, with a type of radio, that will be toggled when the command itself is toggled. This attribute must be omitted unless the type attribute is radio.
type
This attribute indicates the kind of command. This can be one of three values.
  • command or empty which is the default state and indicates that this is a normal command.
  • checkbox indicates that the command can be toggled using a checkbox.
  • radio indicates that the command can be toggled using a radio button.

Examples

<command type="command" label="Save"
    icon="icons/save.png" onclick="save()">

Specifications

Specification Status Comment
HTML5The definition of '<command>' in that specification. Recommendation

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

command

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox No support No

Notes'

No support No

Notes'

Notes' Before Firefox 24, although not implemented, an object of class HTMLCommandElement was created, instead of the compliant HTMLUnknownElement.

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android No support No

Notes'

No support No

Notes'

Notes' Before Firefox 24, although not implemented, an object of class HTMLCommandElement was created, instead of the compliant HTMLUnknownElement.

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

checked

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

disabled

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

icon

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

label

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

radiogroup

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

type

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

Legend

No support  
No support
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.'
Deprecated. Not for use in new websites.
See implementation notes.'
See implementation notes.