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
- Declarative Shadow DOM
- The Popover API
- The selectlist Element
- Interest Invokers and Command Attribute