Component reference

npm Downloads

Weekly installs with trend and goal.

<NpmDownloads variant="minimal" />Clean surfaces and measured motion.

Installation

Use the shadcn CLI to copy the component source and its dependencies into your own project. Installs motion and @number-flow/react, plus the Ovio theme, world, motion, rolling-number, keys, format items.

npx shadcn add JanaSundar/ovio/npm-downloads
↳You own the source. Ovio components arrive in your codebase so you can edit any part of their style, behavior, or data flow.

Usage

Set the visual world on the component, or wrap the page in an OvioProvider to set a default for everything inside it.

TSXvariant="minimal"
import { NpmDownloads } from "@/components/ovio/npm-downloads/npm-downloads"

<NpmDownloads
  variant="minimal"
  packageName="lumen"
  data={downloads}
/>

Built with: CSS · SVG · Motion for React
Motion in Minimal: Small springs, opacity and layout shifts that show state.

Data

Fetch it on the server with getWeeklyDownloads(packageName, weeks) and pass the result as props. The helper is lib/npm.ts, added with the CLI.

npx shadcn add JanaSundar/ovio/npm
SourceThe npm registry's downloads API, summed into Monday-to-Sunday weeks. The current, partial week is left out.
AuthNone.
LimitsOne request per refresh. npm serves up to 18 months, about 78 weeks.
CachingCached for an hour by default (revalidate: 3600), so traffic adds no API calls. A failed refresh keeps serving the last good data, and a spent limit throws RateLimitError with the time it resets.
This demoLive data from hono, through the same helper. If the API fails, the sample shows instead.

Props

Control the data, selected world, animation behavior, and callbacks.

PropTypeDescription
packageNamestringnpm package name.
data{ week: string; downloads: number }[]Weekly history, oldest first.
variant| "minimal" | "craft" | "retro" | "toy"Which world to render. Defaults to the nearest OvioProvider, then minimal.
weeksnumberLatest weeks shown. Default 12.
goalnumberWeekly target. Hidden when left out.
classNamestringMerged onto the root.