ComponentsTimer
Timer
stableCountdown timer with configurable duration and expiry callback.
Browser preview is a simulation. The copied component runs in actual terminal apps.
timer.tsx
Exiting in 00:06
s stop•r reset•q quit
timer.tsx
Installation
npx orizen-tui@latest add timer
if dependency install fails, run: npm install ink@^5.0.1 react@^18.3.1 @types/react@^18.3.18 orizen-tui-core@latest
- Copy and paste the following code into your project.
- Update import paths to match your project setup.
components/ui/orizen/timer.tsx
Usage
timer.imports.tsx
timer.example.tsx
Examples
Usage
timer.example1.tsx
Exiting in 00:06
s stop•r reset•q quit
timer.example1.tsx
API Reference
Timer
PropTypeDefaultDescription
durationMsnumber—Countdown duration in milliseconds
durationMs—
numberCountdown duration in milliseconds
labelstringundefinedText shown before the time display
labelundefined
stringText shown before the time display
onExpire() => voidundefinedCallback fired when countdown reaches zero
onExpireundefined
() => voidCallback fired when countdown reaches zero