Skip to content

useCountdown

jsxhook

useCountdown: counts down from a start value with start, pause, and reset controls

Installation

$ bunx termuijs add use-countdown

Copies the source into src/components/use-countdown/ and installs @termuijs/jsx.

Usage

ts
import { useCountdown } from '@termuijs/jsx'
ts
const { value, set, reset } = useCountdown({
  initial: undefined,
})

API Reference

useCountdown

PropTypeDefaultDescription
initialT | undefinedInitial value
persistbooleanfalsePersist to storage
keystringStorage key
#hook#use-countdown