Nexus UI

Time Scrubber, animated React component

A time picker card where you drag, flick or scroll a ruler of minute ticks under a fixed needle, with momentum, snapping and a rolling clock readout.

  • Free
  • Inputs & Controls
  • Spring

Play with it

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

AM

Props

PropTypeDefaultWhat it does
value—Controlled time in minutes since midnight (0–1439).
defaultValue570Starting time when uncontrolled (570 = 9:30 AM).
onChange—Called with the snapped time whenever it changes.
onCommit—Called once the ruler comes to rest.
interval15Minutes the ruler snaps to (5, 10, 15 or 30 read best).
format"12h"Clock format for the readout and hour labels.
accent"#ef4444"Colour of the centre needle.
density1.6Pixels per minute on the ruler; larger spreads the hours out.
label—Caption above the time, e.g. "Pickup".
disabledfalseDisables dragging, wheel and keys.
className—Extra classes on the card.

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/time-scrubber
  3. 3

    Check what was added

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

    components/
    time-scrubber/
    index.ts
    time-scrubber.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 { TimeScrubber } from "@/components/time-scrubber";
    
    export default function Page() {
      return (
        <main>
          <TimeScrubber />
        </main>
      );
    }