rslabdocs

Countdown Timer

A ring that depletes smoothly as it ticks down, with the remaining time in the center.

ReanimatedSVGHapticsSource

Prerequisites

The ring is SVG, animated with Reanimated, with one haptic when it completes.


npx expo install expo-haptics react-native-reanimated react-native-svg

Install


npx @rslab/cli add countdown-timer

Usage

import { CountdownTimer } from '@/components/ui/CountdownTimer';

<CountdownTimer seconds={15} onComplete={() => console.log('done')} />;

There's no imperative restart method, remount with a changing key instead, which resets the clock, the ring, and the interval in one move:

<CountdownTimer key={runId} seconds={60} color="#171717" />

Props

PropTypeDefault
seconds
number
-

Total countdown duration in seconds.

autoStart?
boolean
true

Start ticking as soon as it mounts.

onComplete?
() => void
-

Called exactly once when the countdown reaches 0.

size?
number
120

Ring diameter in pixels.

strokeWidth?
number
8

Ring thickness in pixels.

color?
string
'#dc2626'

Ring stroke color. Defaults to a red, on purpose, a countdown usually communicates urgency. Pass a neutral like #171717 for a calmer timer.

className?
string
-

Extend or override the outer wrapper.

See exactly how this works with an RSLAB subscription.

Get Pro

On this page