Skip to content

hd-keypad

Attributes and example

hd-keypad

on unlock

A PIN pad: dots, the keys 1–9, ⌫, 0 and ✓. The digits go to the server and nowhere else; the template never sees them. A right PIN (the account’s, set in Account) runs data-hd-on-unlock, whose event carries nothing; a wrong one shakes, and after 5 wrong in a row every keypad of the account waits 5 minutes. Works on a keyboard too (digits, Backspace, Enter, Escape). E.g. <hd-keypad label="Disarm" data-hd-on-unlock="set('homealarm_state', 'disarmed', settings.alarm.id)"></hd-keypad>.

AttributeWhat it is
labelShown above the dots, e.g. Disarm.
shuffleThe digits in a new order each time, against smudges and onlookers.
pinsThe account’s other PINs it takes too, by id, comma-separated; the account’s own always unlocks. Usually from a setting of kind pins: pins="{{ settings.who }}".
<hd-keypad label="Disarm" shuffle data-hd-on-unlock="set('homealarm_state', 'disarmed', settings.alarm.id)"></hd-keypad>

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-danger
Act now: smoke, a leak, an alarm.
--hd-ease-out
The easing of most movement.
--hd-ease-spring
A springy easing, for things that bounce into place.
--hd-focus
The outline round what has keyboard focus.
--hd-font-display
The font of big numbers and headings.
--hd-font-ui
The font of labels and running text.
--hd-good
All is well: locked, closed, cheap.
--hd-motion-fast
A quick change, like a press. 0ms when nothing may move.
--hd-on-accent
Text and icons on the accent.
--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-keypad {  --hd-accent: #2563eb;  max-width: 100%;}
Theme variables