Counter
Counts up on an overdamped spring: fast start, soft landing. Text.
Open playground0
About
Counter is a React component in the Text category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Counter } from "@ashutoshswamy/smoui" and set to, duration, className.
Install
npm i @ashutoshswamy/smouiUsage
import { Counter } from "@ashutoshswamy/smoui";
<Counter to={12480} className="text-5xl font-semibold" />Props 3
- to
Target value.
number- duration
Rough seconds to settle.
numberdefault1.5- className
Class on the <span>.
string
More text components
- FlowTextText filled with a slowly flowing gradient. The ends match, so the loop never jumps.
- ProximityTextLetters swell and lift as the cursor nears them, strongest under the pointer, and settle on springs.
- ScrambleTextText decodes from noise into place, again on every hover.
- ScrollFillTextWords light up one by one as you scroll past, like ink reaching the page.
- SlotTextEach letter is a slot reel that spins through random letters and lands on the right one, left to right.
- SplitTextLetters rise out of a mask one after another on a spring, turning slightly as they land.