Componentdata0.82 KB gzipZero dependencies

Score Keeper

Two-team score keeper with pulse on score change.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add score-keeper

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { ScoreKeeper } from "@/components/ui/score-keeper"; <ScoreKeeper />

Source code

score-keeper.tsx + 1 helper

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

tsxscore-keeper.tsx73 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface ScoreboardTeam {  id: string;  name: string;  score: number;} export interface ScoreKeeperProps extends React.HTMLAttributes<HTMLDivElement> {  teams: [ScoreboardTeam, ScoreboardTeam];  onScoreChange?: (teamId: string, delta: number) => void;} const DEFAULT_TEAMS: [ScoreboardTeam, ScoreboardTeam] = [  { id: "a", name: "Team A", score: 0 },

Props

PropTypeDescription
teams[ScoreboardTeam, ScoreboardTeam]Configures teams. (Default: DEFAULT_TEAMS)
onScoreChange(teamId: string, delta: number) => voidCallback invoked on score change.