Shadcn Counter
A multi-purpose, highly animated Counter component. Whether you need a user-interactive Stepper for e-commerce, an animated statistics ticker, a circular progress tracker, or a promotional countdown timer, this block handles it all with built-in fluid animations. The countdown comes in two designs: framed figures under a pill, or slide — soft tiles where only the figure that changed slides, the same countdown the Waitlist launch panel uses.
Explore the different variations of the Counter component — each example shows a live preview with the exact code to copy.
Slide countdown
Days, hours, minutes and seconds to a date on soft tiles. Watch the seconds: only the figure that changed slides, the others hold still.
- Set
type"countdown" - with
variant="slide"for the tile design. The figures read--until the first tick, so server and client paint the same. targetDate- is a
Date, ISO string or timestamp; left out, it counts three days from mount. doneLabel- replaces
labelonce the date has passed, and the figures go away.
Installation
New project? Follow the installation guide to set up Tailwind CSS, shadcn, the cn helper and lucide-react, register the @avara-ui registry once, then copy your styles from the Themes page.
Install Counter
components/ is written into your project. Copy any snippet from a Usage tab above and it runs.
Install dependencies
Nothing beyond the shared setup — Counter needs only the cn helper and lucide-react, which the installation guide already put in place.
Examples
Stepper
An interactive quantity picker.
type"stepper"- renders the plus/minus quantity control.
min- and
maxclamp the value — the buttons disable at each end. initialValue- is where it starts; state is internal from then on.
label- captions the control above the buttons.
Outline stepper
- Use
variant"outline" - for a bordered, transparent stepper.
Soft stepper
- Use
variant"soft" - for a tinted, low-contrast stepper.
Vertical stepper
- Use
variant"vertical" - to stack the controls for tight sidebars.
Animated ticker
- Set
type"animated" - to interpolate from zero up to
targetValuewhen it scrolls into view.
Circular progress
- Set
type"circular" - to draw the value as an animated SVG ring instead of a number alone.
Countdown
- Set
type"countdown" - to tick down to a target date rather than counting up. This is the default design — framed figures under a pill with a clock.
Features
Explore the Counter component's number animation features, including customizable easing, duration, and formatting options.
Customizable
Easily adapt the component's styling and behavior to fit your application's unique design system.
Accessible
Built with accessibility in mind, ensuring all users can interact with your application effectively.
Responsive
Fully responsive design that looks and works great across desktop, tablet, and mobile devices.
Performant
Optimized for maximum performance with minimal re-renders and efficient state management.
Best Practices & Guidelines
Usage Guidelines
Follow standard design principles when implementing this component. Ensure proper contrast, spacing, and context within your layout.
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
type | "stepper" | "animated" | "circular" | "countdown" | "stepper" | Determines the core functionality and layout of the counter. |
variant | "default" | "outline" | "soft" | "vertical" | "slide" | "default" |
|
color | "primary" | "indigo" | "rose" | "emerald" | "zinc" | "inherit" | string | "primary" | Applies global color themes. Accepts valid hex codes (e.g.
|
label | string | "Counter" | The descriptive text rendered alongside the counter value. |
targetValue | number | 100 | The final number to animate towards (used in |
initialValue | number | 1 | The starting value for the |
| number |
| Sets the bounds for the |
| string | "" | Strings to append before or after the number (e.g. |
bare | boolean | false | Animated only: render just the figure as a |
decimals | number | 0 | Animated only: decimal places shown while counting, e.g. |
startOnView | boolean | false | Animated only: wait until the counter is on screen before counting, so a figure below the fold is seen counting. Under prefers-reduced-motion the target is shown at once. |
className | string | — | Animated only: classes for the figure ( |
targetDate | Date | string | number | 3 days from now | Countdown only: when the timer reaches zero — a |
doneLabel | string | "Time's up" | Countdown only: what the label becomes once the date has passed. The |