Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Time Scrubber, animated React component

A time picker drawn as a ruler you drag or fling under a fixed needle. The ruler coasts and lands exactly on a snap point, the needle ticks at every interval it crosses and bounces when the ruler lands, the digits roll and a small sky chip shifts from night to dawn to day.

  • Pro
  • Inputs & Controls
  • Spring

Ticks for each mark crossed while you drag or fling, then one soft drop when it lands. Sound is off on this site until you switch it on.

Props

PropTypeDefaultWhat it does
value—Controlled value in minutes since midnight (0-1439).
defaultValue570Starting value when uncontrolled (9:30).
onChange—Called with the snapped time whenever the user changes it.
onCommit—Called once the ruler comes to rest after a user change.
interval15Minutes the ruler snaps to.
format"12h"Clock format for the readout and hour labels.
density1.6Pixels per minute on the ruler; larger spreads the hours out.
accent—Needle colour. Defaults to system blue.
label—Caption above the time, e.g. "Pickup".
hint"Drag the ruler, or fling it."One-line hint under the ruler; an empty string hides it.
autoplayfalseFlings the ruler to a few times of day until someone touches it.
disabledfalseDims the picker and ignores input.
enableSoundtruePlays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry with your API key

    Time Scrubber is a Pro item, so the CLI has to send your API key. Do this once per project:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and add this entry inside the outermost braces, next to "aliases". Leave {name} and ${NEXUS_API_KEY} exactly as written; the CLI fills them in:
      "registries": {
        "@nexus-labs": {
          "url": "https://www.nexus-ui.com/api/registry/{name}",
          "headers": {
            "Authorization": "Bearer ${NEXUS_API_KEY}"
          }
        }
      }

How Time Scrubber works

A time picker drawn as a ruler you drag or fling under a fixed needle. The ruler coasts and lands exactly on a snap point, the needle ticks at every interval it crosses and bounces when the ruler lands, the digits roll, and a small sky chip shifts from night to dawn to day.

The source, the install command and the build prompt come with Pro.

Time Scrubber questions

How do I install Time Scrubber?

Run `npx shadcn@latest add @nexus-labs/time-scrubber`. It installs framer-motion. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).

What is Time Scrubber, and when should I use it instead of a time input?

Time Scrubber is a React time picker built as a horizontal ruler: you drag or fling the ruler under a fixed needle and it snaps to the nearest interval. It suits places where a native time input feels slow, such as booking, reminders or alarms. The value is a number of minutes since midnight, so it is easy to store and compare.

How do I get and set the time in Time Scrubber?

Time is a number of minutes since midnight. Use `value` with `onChange` to control it, or `defaultValue` (570, which is 9:30) to leave it uncontrolled. `onChange` receives the snapped time, and `onCommit` fires once the ruler comes to rest.

How do I change the step size and clock format?

`interval` is the number of minutes the ruler snaps to (default 15), `format` is "12h" or "24h" (default "12h"), and `density` is pixels per minute on the ruler (default 1.6). `accent` sets the needle colour and `disabled` ignores input.

Can I use it with a keyboard or mouse wheel?

Yes. The ruler is a focusable `role="slider"` with a spoken time in `aria-valuetext`. Arrow keys move by one `interval`, PageUp and PageDown by 60 minutes, and Home and End jump to the start and end of the day. The wheel and trackpad move one interval per notch.

How is the ruler built, and what happens with reduced motion?

The ticks are DOM elements moved by a Framer Motion value with inertia, with an SVG sun and moon glyph in the sky chip, so there is no canvas. With reduced motion on, the ruler snaps straight to the target time, the digits change without rolling, and the needle bounce is skipped.

Does it make sound, and how do I turn it off?

Ticks for each mark crossed while you drag or fling, then one soft drop when it lands. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.