Componentmedia1.31 KB gzipZero dependencies

Stopwatch

Precision timer with lap tear-offs and digital readout.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add stopwatch

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { Stopwatch } from "@/components/ui/stopwatch"; <Stopwatch autoStart onLap={(lap) => console.log(lap)} />

Source code

stopwatch.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxstopwatch.tsx183 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface LapRecord {  lap: number;  time: number; // in milliseconds  formatted: string;} export interface StopwatchProps extends React.HTMLAttributes<HTMLDivElement> {  autoStart?: boolean;  onLap?: (lap: LapRecord) => void;  className?: string;} export function Stopwatch({

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { Stopwatch } from "@/components/ui/stopwatch"; <Stopwatch />
PropTypeDescription
autoStartbooleanToggles auto start. (Default: false)
onLap(lap: LapRecord) => voidCallback invoked on lap.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.