Docs
Countdown Timer
Countdown Timer
Displays a beautiful Countdown Timer using framer-motion.
Installation
Install the following dependencies:
npm install framer-motion
Copy and paste the cn util code into your project.
import { ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
Copy and paste the Event Calendar code into your project.
API Reference
Here's the API reference documentation in Markdown format for the countdown timer components:
CountdownTimer
A countdown timer component with iOS-style scrolling digits animation.
Props
Prop | Type | Default | Description |
---|---|---|---|
initialMinutes | number | 0 | Initial minutes value for the countdown |
initialSeconds | number | 0 | Initial seconds value for the countdown |
Example
import CountdownTimer from "@/components/countdown-timer";
// 5 minute countdown
<CountdownTimer initialMinutes={5} initialSeconds={0} />
// 2 minutes and 30 seconds countdown
<CountdownTimer initialMinutes={2} initialSeconds={30} />
DigitReel
A component that displays a single digit with an iOS-style scrolling animation effect.
Props
Prop | Type | Required | Description |
---|---|---|---|
value | string | Yes | The digit to display (should be a single character) |
className | string | No | Additional CSS classes to apply to the component |
Example
import DigitReel from "@/components/digit-reel";
// Display the digit "5"
<DigitReel value="5" />
// With custom styling
<DigitReel value="7" className="w-16 h-24" />
Usage Notes
- The
CountdownTimer
component automatically formats numbers to always have two digits - The timer starts automatically when the component mounts
- When the countdown reaches zero, it stops automatically
- The
DigitReel
component creates a scrolling effect with 5 digits (2 before, current, 2 after)