Skip to content

hd-section

Attributes and example

hd-section

on change

A part of the widget that folds open and closed under a heading, like the sections of the widget settings; while closed it shows summary. To remember it per screen, bind open to the widget’s state and keep each change: open="{{ state.schedule }}" data-hd-on-change="setState('schedule', event.value)". Without that it still folds, but starts over when the widget is drawn anew.

AttributeWhat it is
headingrequiredWhat the section is called.
iconSemantic icon before the heading.
summaryA short line beside the heading while closed, e.g. “Next: 21° at 17:00”.
opentrue (open) or false (closed); empty leaves it to start. Bind it to state to remember it.
startHow it starts while open is empty, so before anything is remembered.One of closed, open. Default closed.
variantA heading over a hairline, or a raised card.One of plain, card. Default plain.
<hd-section heading="Details" open="{{ state.details }}"  data-hd-on-change="setState('details', event.value)">  <p>{{ device.name }}</p></hd-section>

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-border
Lines round tiles and between parts.
--hd-border-width
How thick borders are.
--hd-ease-out
The easing of most movement.
--hd-ease-spring
A springy easing, for things that bounce into place.
--hd-flat
1 on e-ink: no colours, glows or gradients, only black and white.
--hd-focus
The outline round what has keyboard focus.
--hd-font-ui
The font of labels and running text.
--hd-motion-base
An ordinary change, like a value sliding.
--hd-motion-fast
A quick change, like a press. 0ms when nothing may move.
--hd-radius-md
Medium corners: buttons, fields.
--hd-radius-sm
Small corners: chips, small buttons.
--hd-surface-raised
Something on a tile that stands out from it, like a button.
--hd-text
Text and big numbers.
--hd-text-faint
The quietest text: hints, units, times.
--hd-text-muted
Labels and secondary text.

Style the host

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