Skip to content

hd-motion

Live preview

<hd-motion value="{{ cap.onoff.value }}" play="success" press>  <button data-hd-on-click="toggle('onoff')">{% if cap.onoff.value %}On{% else %}Off{% endif %}</button></hd-motion>

Attributes and example

hd-motion

The motion kit around anything: plays a motion when value changes, wiggles while busy, and shakes when a command ends with value where it began (refused, or never answered). Follows the motion level: reduced motion only fades (a pulse while busy), e-ink shows nothing.

AttributeWhat it is
valueWhat it follows, e.g. {{ cap.onoff.value }}; a change plays play.
playWhat a change of value plays.One of settle, success, press, refused, none. Default settle.
busyA command is on its way: present, or true (false is not busy), e.g. {% if pending.onoff %} busy{% endif %} or busy="{{ b.busy }}".
refusedWhat a refused command plays.One of refused, settle, none. Default refused.
pressA tap on it plays the press motion.
blockTakes the full width instead of fitting its content.
<hd-motion value="{{ cap.onoff.value }}" play="success" press>  <button data-hd-on-click="toggle('onoff')">{% if cap.onoff.value %}On{% else %}Off{% endif %}</button></hd-motion>

Styling

Set CSS variables on the component element. Its internal elements live in Shadow DOM; only the exposed named parts can be styled with ::part.

No component-specific CSS variables are exposed. Use the host element’s sizing and the documented theme variables.

Style the host

hd-motion {  --hd-accent: #2563eb;  max-width: 100%;}
Theme variables