Vibary.ai
← Vibe Coding

Empty to Loaded Count

A stat card sitting at zero rolls up to its real figure once the data resolves.

loadingfriendlycalmautomatic · finite · intermediate · ~1.6s
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

418 lines · react + motion only
import { useEffect, useRef, useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Empty to Loaded Count
 *
 * A stat that starts at zero because nothing has loaded yet, and rolls up
 * to the real figure when it does. Each digit column moves by

About this pattern

The moment a dashboard renders its shell before the numbers exist. The card shows a genuine zero and an honest caption rather than a placeholder block, then climbs to the real figure on a decelerating curve so the last few values are slow enough to read. Each digit column moves by translation with a short crossfade and holds one type size throughout — a figure that scales while it counts is a figure you have to re-read. A hidden copy of the final string reserves the width from the first frame, so a count growing from one digit to four never resizes the card or re-centres the type, and only the settled figure is announced to assistive tech.

Dashboard stat cardUsage totalWorkspace homeReport header figure

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • OverviewLast 30 days
    Revenue$48,210+12.4%
    Orders1,284+3.1%
    Refunds$1,940−0.8%
    Revenue by day
    Analytics view

    Headline figures resolve from an empty shell as the query returns.

Related patterns