--- title: "Invoker commands" category: foundations status: optional url: https://webspecification.com/spec/foundations/invoker-commands/ updated: "2026-07-06T00:00:00.000Z" sources: - title: "HTML Standard — The button element (command, commandfor)" url: "https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-command" publisher: "WHATWG" - title: "HTML Standard — CommandEvent" url: "https://html.spec.whatwg.org/multipage/interaction.html#commandevent" publisher: "WHATWG" - title: "MDN — Invoker Commands API" url: "https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API" publisher: "MDN" - title: "Open UI — Invokers explainer" url: "https://open-ui.org/components/invokers.explainer/" publisher: "Open UI" source_repo: undefined licence: CC-BY-4.0 --- # Invoker commands > Wire a button to open a popover, close a dialog, or run a custom action declaratively with command and commandfor — no click handler, no ARIA plumbing. ## What it is Invoker commands let a ` ``` The built-in commands cover the common overlay patterns: `show-popover`, `hide-popover`, `toggle-popover` for [popovers](/spec/foundations/popover-api/), and `show-modal`, `close`, `request-close` for ``. Any value prefixed with two dashes (for example `command="--rotate"`) is a **custom command**: the browser fires a `CommandEvent` on the target carrying that name, and your script decides what to do — invoker wiring without a built-in action. ## Why it matters - **Less JavaScript for common patterns.** Opening a popover or closing a dialog no longer needs a click handler. The relationship lives in markup the browser understands. - **Accessibility comes for free.** The control is a real `

Delete this item?

``` Treat it as progressive enhancement where you still support older browsers: a button with a JavaScript fallback degrades to a normal control. ## Common mistakes - **Putting `command`/`commandfor` on a non-button.** They only work on `