Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Weather Puck, animated React component

  • Pro
  • Inputs & Controls
  • Glow

Drag a glowing puck across a field of dots to set the time of day. Nearby dots lift and warm, and the landscape above relights from dawn to night with the hour name and clock rolling along.

Props

PropTypeDefaultWhat it does
spacing14Gap between the dots in px, 8 to 24. Smaller packs more dots in.
dotSize1Size of the dots, 0.6 to 1.8.
reach1How far the light reaches across the dots, 0.5 to 2. Higher lights up more of them.
lift1How high nearby dots rise, 0 to 2. 0 keeps them flat.
showClocktrueShows the clock under the name of the hour. Set false to show only the name.
autoplayfalseSweeps the light across the day until someone drags it.

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

    Weather Puck 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 Weather Puck works

Drag the light across a field of dots. Dots near it lift and warm up, and the landscape above relights in real time: sky, sun, ridges and the name of the hour all interpolate from the puck's position.

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

Weather Puck questions

How do I install Weather Puck?

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

Which props does it take, and can I read the chosen time?

The only prop is `autoplay` (default `false`), which sweeps the light across the day until someone drags it. There is no value or change callback; the hour name and clock are rendered inside the component.

What times and hour names does it show?

The hour name is one of Before dawn, Sunrise, Midday, Golden hour, Dusk or Night. The clock runs from 04:30 to 23:30 as the puck moves left to right. Moving it up or down only changes the dot glow.

Can I move the puck with the keyboard?

Yes. The puck is a focusable `role="slider"` named "Time of day", and the Left and Right arrow keys move it 30px at a time. Its `aria-valuetext` reads the hour name and clock, such as "Dusk" with the time.

How is it drawn?

The dot field is a 2D canvas redrawn every frame. The sky, sun, ridges and labels are interpolated from the puck position with Framer Motion. The resting dots follow the site's `dark` class. It is 440px wide at most and shrinks to fit.