Componentdata0.82 KB gzipZero dependencies
Score Keeper
Two-team score keeper with pulse on score change.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add score-keeperOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { ScoreKeeper } from "@/components/ui/score-keeper"; <ScoreKeeper />Source code
score-keeper.tsx + 1 helperZero 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
| Prop | Type | Description |
|---|---|---|
| teams | [ScoreboardTeam, ScoreboardTeam] | Configures teams. (Default: DEFAULT_TEAMS) |
| onScoreChange | (teamId: string, delta: number) => void | Callback invoked on score change. |