Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Countdown
  3. API and Development

Countdown

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import Countdown from @prepared911/ui/countdown.
Countdown
PropTypeDefaultNotes
secondsnumberrequiredStarting duration; changing it starts a new session.
activebooleantrueArms the timer. A false-to-true transition rearms it.
message(seconds: DisplayValue, count: number) => LocalizedMessagerequiredComplete localized sentence containing the formatted seconds exactly once.
announcement(seconds: number) => LocalizedMessagerequiredCalled only at 30, 10, and 5 seconds.
cancelLabelLocalizedMessagerequiredVisible label for the control that stops the action.
cancelledMessageLocalizedMessagerequiredReplaces the timer after cancellation.
completedMessageLocalizedMessagerequiredReplaces the timer after completion.
onCancel() => voidrequiredCalled after the internal timer stops.
onComplete() => voidrequiredCalled once when an armed timer reaches zero.
deadlinenumbergenerated from secondsAbsolute Unix timestamp in milliseconds for synchronized countdowns.
localestringruntime localeBCP 47 locale for the number.
idstringRoot element id.
refRef<HTMLDivElement>Root element ref.
Props
NameTypeDefaultDescription
announcementCountdownAnnouncement—Polite announcement produced at 30, 10, and 5 seconds remaining.
cancelLabelLocalizedMessage—Visible label for the control that stops the automatic action.
cancelledMessageLocalizedMessage—Visible line shown after the person stops the automatic action.
completedMessageLocalizedMessage—Visible line shown after the automatic action reaches its deadline.
messageCountdownMessage—Complete localized sentence containing the formatted remaining-seconds placeholder exactly once.
onCancel() => void—Called after the person stops the automatic action.
onComplete() => void—Called once when an armed countdown reaches zero.
secondsnumber—Whole seconds in a newly armed countdown and the maximum readout when deadline is supplied. Non-finite values become 0; finite values are rounded down and kept at 0 or above. Changing the resolved value restarts the countdown.
activebooleantrueWhether the countdown is armed. Each transition from false to true starts from seconds, or catches up to deadline when one is supplied; false holds the starting value and makes the keep control unavailable.
classNamestring—@deprecated Pass layout through enum props and shipped parts. Request a missing case via find-pattern.
deadlinenumber—Absolute Unix timestamp in milliseconds for a shared deadline. When omitted, Countdown creates a deadline from seconds. Changing the deadline starts a new session.
idstring—Id of the root element.
localestring—BCP 47 locale for the remaining number. Defaults to the runtime locale, so a server-rendered app that must match the client passes it explicitly.
refRef<HTMLDivElement>—Ref to the root element.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Countdown / Usage
Next
Countdown / Accessibility
On this page
Countdown
Props
Storybook