Skip to content

hd-meter

Live preview

<hd-meter value="{{ cap.measure_humidity }}" max="100" zones="60:warn,75:danger"></hd-meter>

Attributes and example

hd-meter

A straight bar filled up to a value within a range: progress, a level, how full a tank or bin is. Sideways, or filling from the bottom up with orientation="vertical". It draws only the bar; write the value next to it. Its thickness is the CSS variable --hd-meter-size (10px sideways; the full width upright), its rounding --hd-meter-round. Parts: ::part(bar), ::part(fill).

AttributeWhat it is
valueWhat it fills up to, e.g. {{ settings.tank.value }} or a number; a live capability brings its own range. Or a live capability of any device, followed: {{ settings.x.cap.measure_power }}.
minMinimum; defaults to the capability’s, else 0.
maxMaximum; defaults to the capability’s, else 100.
markerA second value shown as a line across the bar, e.g. a target. Or a live capability of any device, followed: {{ settings.x.cap.measure_power }}.
colorA theme colour name (accent, lit, cool, good, warn, danger, text, surface, canvas, chart-1…chart-6) or #rrggbb: whatever a Colour setting gives.One of accent, lit, cool, good, warn, danger, chart-1, chart-2, chart-3, chart-4, chart-5, chart-6.
zonesStretches of the range in a colour (a theme colour name or #rrggbb), each from a value up to the next: 60:warn,80:danger. They tint the track (the empty part); how they colour the fill is zone-fill.
zone-fillHow the zones colour the fill: value (all of it in the colour of the zone the value is in), sections (each part in its zone’s colour, its own colour below the first zone) or track (always its own colour; the zones only tint the track).One of value, sections, track. Default value.
orientationSideways, or upright filling from the bottom (a tank).One of horizontal, vertical. Default horizontal.
<hd-meter value="{{ cap.measure_humidity }}" max="100" zones="60:warn,75:danger"></hd-meter>

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-canvas
The page behind the tiles: a colour or a gradient.
--hd-ease-out
The easing of most movement.
--hd-meter-round
CSS input read by hd-meter.
--hd-meter-size
CSS input read by hd-meter.
--hd-motion-slow
A slow change, like a theme switching.
--hd-radius-sm
Small corners: chips, small buttons.
--hd-text
Text and big numbers.
--hd-track
The empty part of a slider, bar or ring.

Exposed parts

hd-meter::part(bar) {  /* Your styles */}hd-meter::part(fill) {  /* Your styles */}

Style the host

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