components / timer-ring

timer-ring.

circular progress ring driven by stroke-dasharray. takes a value/max pair, or an endsAt deadline it counts down to on its own clock, with the remaining time in the center.

00:45
until break
68%
weekly goal
installation
bunx @justin06lee/chrome@latest add timer-ring
props
nametypedefaultdescription
valuenumber0determinate value; ignored in countdown mode.
maxnumber100upper bound for value.
endsAtnumber | Date-countdown target. setting it makes the ring tick itself once a second.
startedAtnumber | Datemount timethe 0% anchor for a countdown; given only endsAt, the ring starts empty at mount.
sizenumber128outer edge in px.
thicknessnumber2stroke width in px.
accentstring'#fff'css color for the progress arc.
labelReactNode-center slot. defaults to the remaining time (countdown) or a percentage; pass null for a bare ring.
onComplete() => void-fired once when a countdown reaches endsAt; re-arms if endsAt changes.
direction'fill' | 'drain''fill''drain' empties the arc as time runs out.
ariaLabelstring-
classNamestring-