Handle taps and control changes
HdScript is the small action language used in a template’s event attributes.
Attach an action
Call an allowed action from a template event handler. A control can pass its new value through event.value.
<button data-hd-on-click="toggle('onoff')">Switch light</button><hd-slider value="{{ cap.dim.value }}" data-hd-on-change="set('dim', event.value)"></hd-slider>Combine actions and local state
Separate steps with semicolons. setState changes local widget UI state; it does not write a setting or a Homey capability.
setState('tab', 'details'); toast('Details selected')Supported syntax
Use literals, context property access, arithmetic, comparisons, boolean operators, ternary choices and calls to allowed functions. Handlers cannot declare variables, loop, use new or this, reach browser globals or call arbitrary JavaScript. Keep template actions distinct from client.js.