Nexus UI

Price Odometer, animated React component

A seat-based pricing card whose total rolls like an odometer: each digit spins on its own spring, columns slide in as the number grows, and a Save badge pops in for yearly billing.

  • Free
  • Pricing Sections
  • Spring

Play with it

Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.

$/mo
$15 per seat, billed monthly
8

Props

PropTypeDefaultWhat it does
monthlyRate15Price per seat when billed monthly.
yearlyRate12Price per seat when billed yearly. The Save badge is worked out from the two rates.
maxSeats100Top of the seats slider.
accent"#0071e3"Slider fill and badge colour.
autoplayfalseChanges seats and billing by itself until someone interacts.

Add it to your project

  1. 1

    Prepare your project

    You need Tailwind CSS and the @/import alias. If shadcn isn't set up yet, initialise it once:

    npx shadcn@latest init

    Then add the Nexus registry to your components.json (the registries key is the part that matters):

    {
      "$schema": "https://ui.shadcn.com/schema.json",
      "style": "default",
      "rsc": true,
      "tsx": true,
      "tailwind": {
        "css": "src/app/globals.css",
        "baseColor": "neutral",
        "cssVariables": true,
        "prefix": ""
      },
      "aliases": {
        "components": "@/components",
        "utils": "@/lib/utils",
        "ui": "@/components/ui",
        "lib": "@/lib",
        "hooks": "@/hooks"
      },
      "registries": {
        "@nexus-labs": "https://www.nexus-ui.com/api/registry/{name}"
      }
    }
  2. 2

    Add the component

    Run this from your project root. It adds the component, the utilities it uses and its packages.

    npx shadcn@latest add @nexus-labs/price-odometer
  3. 3

    Check what was added

    With the standard aliases, these files land in your project:

    components/
    price-odometer/
    index.ts
    price-odometer.tsx
  4. 4

    Copying by hand? Install the packages

    Skip this if you used the command above.

    npm install framer-motion
  5. 5

    Use it in a page

    Import it and render it. The Code tab above has the full example.

    // app/page.tsx
    import { PriceOdometer, RollingNumber } from "@/components/price-odometer";
    
    export default function Page() {
      return (
        <main>
          <PriceOdometer />
        </main>
      );
    }