Count Up

A number that counts to its value the first time it scrolls into view: "120 sources", "4.8k readers", "98%". The figure is the content, so the component is built around reading it, not around the motion.

data displayclientuiv1.0.0

Preview

Count Up — live rendereffects-countup--default ↗

Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.

Install

Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.

Via shadcn URL
npx shadcn@latest add https://ds.interlace.tools/r/count-up.json
With the @interlace alias
npx shadcn@latest add @interlace/count-up

Behavior

What this component does — the keyboard path, the measured colour, the text equivalent and the states it can be in. Every figure below is read out of the test or the source that enforces it by scripts/build-behavior-map.mjs, so nothing here can outlive the gate that keeps it true.

A chart's alt text is not a sentence about the chart — the equivalent of the data is the data. This is what a screen reader gets, read out of the source the install writes into your tree.

Label, not a data equivalentShips sr-only copy

Ships sr-only copy for what the visual carries by position, colour or icon alone — a label, not a full data equivalent.

Where it renders, how narrow it survives, and whether its lines are inside the coverage gate — three answers a consumer needs before the paste, not after the bug.

Render boundary
'use client'

Hydrates. It brings JavaScript to any route that imports it — put the boundary here, not at the page.

Minimum viewport
none declared

No width floor: it takes the width it is given. Its container owns the layout question.

Coverage gate
not in the gate

The 100% gate currently covers src/charts/**/*.{ts,tsx} and src/lib/**/*.{ts,tsx} and src/primitives/{button-variants,data-state-model,meter-scale,skeleton-variants}.ts and src/primitives/{alert,aspect-ratio,avatar,badge,box,breadcrumb,button,callout,card,checkbox,code-editor,container,data-state,focus-ring,grade-badge,grid,input,label,meter,pagination,published-date,reading-time,section,section-boundary,separator,skip-link,stack,stat-strip,tag,textarea,typography,visually-hidden}.tsx and src/patterns/lint-playground.tsx. This file is outside it — the glob widens in phase 7.2.

History

This component is at v1.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.

Unreleased1 entry

  • Breakingmajor

    The last borrowed motion components are replaced with Interlace's own, written from scratch. Content that moves now renders in full on the server and is announced once; decoration is a layer you drop inside any component, so a button stays a Button and a card stays a Card: - CountUp: a number that counts to its value when it scrolls into view. The server renders the final figure, the box never shifts, and format takes any Intl.NumberFormat options. - Scroller: a looping row of items. Each item is announced and tabbed to once, a visible Pause button sits beside it, and under reduced motion it becomes a plain scrollable row. - StaggerList: a real ul or ol whose items arrive one by one, once. Focus shows an item at once. - SheenText: a few words painted with a slow travelling gradient, on text-grade tokens, with a forced-colours fallback. - Sheen: a band of light that crosses its parent. Put it inside a Button; it sits under the label. - EdgeGlow: a light that runs around the edge of a Card or any positioned element. - GridField: graph-paper lines or a dot grid, with a few seeded (or chosen) cells that light up and fade, and with interactive, the cell under the pointer. Button is now relative isolate and Card is relative, so Sheen and EdgeGlow work inside them with no extra classes.

    Migration

    The @interlace/ui/magicui/* entry points and their registry items are removed. Replace NumberTicker with CountUp (value, from, duration, and format for decimals or compact notation), Marquee with Scroller (direction, duration, gap, pauseOnHover; children become list items), AnimatedList with StaggerList (it reveals once and does not loop), AnimatedGradientText with SheenText (from, to, duration), ShimmerButton with a Button that contains a <Sheen />, BorderBeam with EdgeGlow (from, to, width, length, duration), AnimatedGridPattern, InteractiveGridPattern, GridPattern and DotPattern with GridField (mark="lines" | "dots", cell, lit or cells, seed, fade, interactive; GridPattern's squares become cells), and Particles with Starfield.

Import

Single named export.

Public API
import { CountUp } from '@/components/ui/effects/count-up';

API reference

Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.

CountUpProps

Also accepts every <span> attribute.

PropTypeDescription
value*numberThe number to show.
fromnumberWhere the count starts. @default 0
durationnumberLength of the count, in milliseconds. @default 1200
formatIntl.NumberFormatOptionsHow to write the number: any `Intl.NumberFormat` options. @default {}
localestring | string[]Locale for the formatter. @default the browser's
start'visible' | 'mount'Count when the number scrolls into view, or as soon as it mounts. @default 'visible'

Accessibility

Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.

What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.

Focus + keyboard behaviour
Native element semantics — no interaction layer to get wrong.
Focus ring (WCAG 2.2 SC 2.4.13)
Not focusable — no focus indicator required.
Reduced motion
Animation is gated on prefers-reduced-motion.
ARIA in the source
None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.

Examples

4 more states from the same story file.

R-rule compliance

Every primitive in @interlace/ui models to the portable 26-rule floor enforced by the componentApi ESLint preset. The cells below pin exactly where each rule applies in this file.

RuleConceptWhere
R4Extends native el`span` props
R6data-slot per partcount-up / -label / -digits
R7cn + ...rest`cn(…, className)` + `{...props}`
R8Enums, not booleans`start`
R19Tokens onlyinherits `currentColor`; no colour of its own
R25Client componentthe count runs in the browser
R26A11yone stable label; moving digits hidden

Dependencies

Base UI primitive
Native / no Base UI dependency
Lucide icons
none
NPM dependencies
none

Source

The full implementation — components/ui/effects/count-up.tsx once installed.

177 lines · TypeScript
'use client';

import * as React from 'react';

// @interlace/count-up v1.0.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/count-up
// What changed since: https://ds.interlace.tools/c/count-up#history
// Generated banner — keep it, the upgrade diff reads this version.

/**
 * @interlace/ui — CountUp
 *
 * A number that counts to its value the first time it scrolls into view:
 * "120 sources", "4.8k readers", "98%". The figure is the content, so the
 * component is built around reading it, not around the motion.
 *
 * ## The number is always there
 *
 * The server renders the final value, so a page without scripts, a crawler
 * and a screen reader all get the real figure. On the client, before the

…157 more lines…

Registry JSON

The raw registry record — what the shadcn CLI fetches.