Skip to content

hd-socket

Live preview

<hd-socket on="{{ cap.onoff }}" power="{{ cap.measure_power }}" size="48px"></hd-socket>

Attributes and example

hd-socket

A plug and socket that snap together when it switches on and pull apart when it switches off, with a short pulse from the joint when power starts to flow. Reduced motion fades; e-ink snaps.

AttributeWhat it is
onIts state; a change snaps it in or pulls it out. Or a live capability of any device, followed: {{ settings.x.cap.onoff }}.
powerWatts, e.g. {{ cap.measure_power.value }}; starting to flow pulses once. Or a live capability of any device, followed: {{ settings.x.cap.measure_power }}.
sizeCSS size, e.g. 18px; or set --size.Default 1em.
labelAccessible label; otherwise “On” or “Off”.
<hd-socket on="{{ cap.onoff }}" power="{{ cap.measure_power }}" size="48px"></hd-socket>

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.

--hd-ease-out
The easing of most movement.
--hd-lit
The warm colour of a device that is on.
--hd-motion-base
An ordinary change, like a value sliding.
--hd-motion-tempo
CSS input read by hd-socket.
--hd-socket-off
CSS input read by hd-socket.
--hd-text-muted
Labels and secondary text.

Style the host

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