0Pricing
HTML Academy · Lesson

Interest Invokers and Command Attribute

Explore the command and commandfor attributes for declarative actions.

Two Emerging Declarative Patterns

The Open UI group is standardizing two new HTML attributes — command for click-triggered actions, and interesttarget for hover/focus-triggered "interest" (the basis of tooltips and previews). Both extend HTML with declarative behaviors that have traditionally required JavaScript.

The command Attribute

A button with command="show-modal" and commandfor="dialog-id" shows a dialog without any JS — replacing manual dialog.showModal() calls. Other commands: command="close", command="toggle-popover", command="show-popover".

<button command="show-modal" commandfor="my-dialog">Open</button>
<dialog id="my-dialog">...</dialog>

All lessons in this course

  1. Declarative Shadow DOM
  2. The Popover API
  3. The selectlist Element
  4. Interest Invokers and Command Attribute
← Back to HTML Academy