Skip to content

hd-map

Attributes and example

hd-map

A map with a pin for each hd-map-pin inside it; pins glide when they move and the map follows them, framing all or one. Light or dark with the theme. Reduced motion jumps; e-ink is a still map in greys. Lists the places where maps can’t be drawn.

AttributeWhat it is
viewfit: all pins in view; follow: centred on the follow pin.One of fit, follow. Default fit.
followThe device of the pin to follow (drawn in the accent).
zoomHow close it comes, 3 to 18; fitting never zooms closer.Default 15.
lookauto (with the theme), light, dark or streets.One of auto, light, dark, streets. Default auto.
interactivetrue: one finger scrolls the page, two fingers move or pinch-zoom the map; a mouse drag moves it. false keeps it still to the touch. The wheel always scrolls the page.Default true.
labelAccessible label; otherwise it lists the places.
<hd-map zoom="14">  <hd-map-pin lat="52.3731" lon="4.8922" name="Home"></hd-map-pin>  <hd-map-pin lat="52.3602" lon="4.8852" name="Car" icon="device.vehicle"></hd-map-pin></hd-map>

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-appearance
`light`, `dark` or `paper`, for what colours alone can’t decide.
--hd-border
Lines round tiles and between parts.
--hd-border-width
How thick borders are.
--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-motion-slow
A slow change, like a theme switching.
--hd-motion-tempo
CSS input read by hd-map.
--hd-on-accent
Text and icons on the accent.
--hd-overlay
Menus, dialogs and popups over the page.
--hd-shadow
A tile’s shadow.
--hd-surface
A tile’s colour.
--hd-surface-raised
Something on a tile that stands out from it, like a button.
--hd-text
Text and big numbers.
--hd-text-muted
Labels and secondary text.
--hd-warn
Worth a look: a low battery, a door open for a while.

Style the host

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