Score counter
Score counter is a neobrutalist React component from Cruise UI. Coins or points in Baloo 2 with a coin or star chip; counts up when it changes, with a floating +50. Install it with npx shadcn@latest add @cruiseui/score-counter.
Install
Terminal
npx shadcn@latest add @cruiseui/score-counterFirst time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.
Example
Corners
Coins: 12,450Stars: 980
"use client";
import { useState } from "react";
import { CruiseButton } from "@/components/cruise/button";
import { CruiseScoreCounter } from "@/components/cruise/score-counter";
export default function ScoreCounterExample() {
const [coins, setCoins] = useState(12450);
return (
<div className="flex flex-wrap items-center gap-6">
<CruiseScoreCounter value={coins} label="Coins" />
<CruiseScoreCounter value={980} icon="star" label="Stars" />
<CruiseButton onClick={() => setCoins((c) => c + 50)}>Collect 50 coins</CruiseButton>
</div>
);
}
<span class="score">
<span class="score-chip" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="8" cy="8" r="6"/><path d="M18.1 10.4A6 6 0 1 1 10.3 18"/></svg></span>
<span class="score-value" aria-hidden="true">12,450</span>
<span class="visually-hidden" aria-live="polite">Coins: 12,450</span>
</span>Needs theme.css. Interactive parts (menus, tabs, drawers) also need the script in the spec for that component.
When to use it
When to use
Game HUDs and loyalty points.
When not to
Money people spend (show the amount plainly).
Props
CruiseScoreCounter
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | — |
label? | string | "Coins" | What it counts, for screen readers ("Coins", "Score"). |
icon? | ReactNode | "coin" | — |
showDelta? | boolean | true | Float "+50" when the value goes up. |
className? | string | — | — |
Accessibility
- Screen readers hear the new total once (aria-live polite), never the frames in between.
- Counting and the floating +50 stop under reduced motion.