SwipeUI

Countdown

Deadline-based countdown with rolling digits and a single completion confetti burst.

npx @swipeui/cli add countdown
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Launches, live events, auctions or sales that start at a set time.
  • "Starts in" timers on event and streaming screens.
  • Showing a live state, such as a Watch now button, when the time arrives.

When not to use it

  • Workout or cooking timers people start and pause. Build those with your own state.
  • Long-range dates days away; show the date instead.
  • Progress through a task. Use Progress.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add countdown
  • Adds components/swipeui/ui/countdown.tsx, components/swipeui/ui/countdown-confetti.tsx and 7 shared helpers.
  • Installs react-native-reanimated, react-native-worklets, uniwind, clsx, tailwind-merge, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/launch.tsx
import { Countdown } from '@/components/swipeui/ui/countdown';

<Countdown endsAt={launchAt} label="Launch starts in" />;

Examples

Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.

API reference

CountdownProps

PropTypeDefaultDescription
format?"clock" | "seconds" | "units"'clock'

Clock, separated time units or total seconds.

appearance?"elevated" | "plain"'plain'

Plain numbers or elevated surfaces.

numberStyle?"display" | "mono" | "sans"'mono'

Number typography.

numberTextClassName?stringundefined

Caller numeral classes.

unitLabels?{ hours: string; minutes: string; seconds: string; }hours/minutes/seconds

Translated unit labels.

endsAtnumber—

Absolute epoch milliseconds; never a decrementing duration.

onComplete?(() => void)—

Invoked once for each distinct deadline, when first observed at or after zero.

liveLabel?string'Complete'

Displayed at zero; legacy prop name retained.

confetti?booleantrue

One confetti burst per deadline; respects reduced motion and visibility.

liveContent?ReactNode—

Optional live-state content.

label?string'Starts in'

Spoken timer purpose.

motion?MotionOverride—

Shared rolling-number feel.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Native layout escape hatch.

testID?string—

Root ID.

Native view/input props not listed here pass through where the exported TypeScript type allows them.

Composition and behavior

  • endsAt is the deadline; label names it, such as "Starts in".
  • liveLabel or liveContent replace it at zero; onComplete runs once per deadline.

Feedback lineup settings

PropDoes / default
formatClock, separated time units or total seconds. @default 'clock'
appearancePlain numbers or elevated surfaces. @default 'plain'
numberStyleNumber typography. @default 'mono'
numberTextClassNameCaller numeral classes. @default undefined
unitLabelsTranslated unit labels. @default hours/minutes/seconds
endsAtAbsolute epoch milliseconds; never a decrementing duration.
onCompleteInvoked once for each distinct deadline, when first observed at or after zero.
liveLabelDisplayed at zero; legacy prop name retained. @default 'Complete'
liveContentOptional live-state content.
labelSpoken timer purpose. @default 'Starts in'
motionShared rolling-number feel.
classNameRoot classes.
styleNative layout escape hatch.
testIDRoot ID.

Behaviour

format is clock, units or seconds; appearance is plain or elevated. numberStyle selects mono, sans or display; numberTextClassName customizes numerals. All clocks use absolute endsAt deadlines and recalculate on resume. Each specimen starts with a ten-second deadline and Restart resets it.

Completion defaults to Complete with one confetti burst per deadline. confetti={false} disables the burst; Reduce Motion keeps the static completion message. The Live demo board was removed; liveLabel and liveContent remain supported for existing callers. Restart with a new deadline to begin a fresh countdown and completion event.

Behavior and gestures

  • Counts down once a second with rolling digits.
  • At zero it switches to the live label or your liveContent, and onComplete runs once.
  • It uses an absolute end time, so it stays correct after the app was in the background.

Accessibility

  • Announced as a timer with full words, such as "Starts in 2 hours, 5 minutes, 10 seconds".
  • The live state is announced once when it arrives.
  • Rolling digits are hidden from screen readers to avoid chatter.

Motion

  • Uses the number and ambient motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Digits roll with the number role.
  • Reduce Motion changes digits instantly.

Performance

  • One tick per second; it never counts down a duration that could drift.

Notes for AI

  • Pass endsAt as epoch milliseconds from your server.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items