Skip to content

hd-clock

Live preview

<hd-clock show="time"></hd-clock><hd-clock show="date" date-style="long"></hd-clock>

Attributes and example

hd-clock

The time or the date, ticking on its own. AM/PM and seconds are parts: ::part(period), ::part(seconds).

AttributeWhat it is
showWhat to show.One of time, date. Default time.
secondsShow seconds (not on e-ink).Default false.
hour-cycle12 or 24 hours; auto follows the browser’s language.One of auto, 12, 24. Default auto.
date-styleFor the date: “Tuesday 6 October”, “6 Oct” or “Tuesday”.One of long, short, weekday. Default long.
<hd-clock show="time"></hd-clock><hd-clock show="date" date-style="long"></hd-clock>

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.

No component-specific CSS variables are exposed. Use the host element’s sizing and the documented theme variables.

Exposed parts

hd-clock::part(period) {  /* Your styles */}hd-clock::part(seconds) {  /* Your styles */}

Style the host

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