Skip to content

hd-segmented

Live preview

<hd-segmented bind="{{ cap.thermostat_mode }}" options="auto:Auto,heat:Heat,off:Off" label="Mode"></hd-segmented>

Attributes and example

hd-segmented

on change

One of a few choices side by side, the chosen one filled: a thermostat’s mode, a fan’s speed, a house mode. Bound with bind to a capability with choices (an enum), they come from it, in its order and named as Homey names them; otherwise options lists them. The choice shows at once and is sent, shown as on its way until the Homey reports it back. More than fit scroll sideways, the chosen one kept in view. With value and data-hd-on-change a handler decides what a choice does (setState, setVariable).

AttributeWhat it is
bindThe capability it is bound to, e.g. {{ settings.light.cap.dim }} (the whole capability, no .value): it shows its value, takes min, max and step from it, and sends changes back (shown at once, sprung back if refused, range checked). A device that is unavailable shows its last value, disabled.
valueThe explicit form instead of bind: what it shows, e.g. {{ state.mode }} (or a live capability, followed); a change only goes to data-hd-on-change, which decides what it does. Without a handler it can’t be changed.
optionsThe choices as value:Name, separated by commas, e.g. eco:Eco,comfort:Comfort; with bind it renames the capability’s.
toneThe colour of the chosen one.One of accent, lit, cool. Default accent.
labelAccessible label for the group.
<hd-segmented bind="{{ cap.thermostat_mode }}" options="auto:Auto,heat:Heat,off:Off" label="Mode"></hd-segmented>

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-accent
The theme’s accent: active controls, links, highlights.
--hd-cool
The cool counterpart: cooling, cold water, low prices on some themes.
--hd-ease-out
The easing of most movement.
--hd-focus
The outline round what has keyboard focus.
--hd-font-ui
The font of labels and running text.
--hd-lit
The warm colour of a device that is on.
--hd-motion-base
An ordinary change, like a value sliding.
--hd-on-accent
Text and icons on the accent.
--hd-text
Text and big numbers.
--hd-text-muted
Labels and secondary text.
--hd-track
The empty part of a slider, bar or ring.

Style the host

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