1. Reference
  2. Display

<countdown>

A timer that counts down to zero in a format you choose and can act when it gets there.

Display

This tag has more than one name. Every spelling is the same tag, so write whichever feels natural. Pick one and every example on this page uses it.

countdown.ham
<column style="items-center gap-8">
    <text style="muted">Next question in</text>
    <countdown seconds="90"
               format="mm:ss"/>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
format Display format
hh:mm:ss, mm:ss, ss
mm:ss
seconds Total seconds to count down
number
60

Events

NameWhat it does
on-done Statements run once when it reaches 0 (same as action-done / @on.done). Not while hidden by @show: hidden, it waits at its full time and starts over when shown; removed before 0, it never fires; mounted again (@@show, a new key), it counts from the top.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

Guides and recipes that use it

This page is also Markdown, and all of HAM is in llms.txt.