Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Dot Sphere, animated React component

A turning sphere of dots drawn on canvas: the pointer parts the dots as it passes, and dragging spins it in any direction before it coasts back to its idle turn. Tap it and a ripple rolls out from that spot, swelling the dots and lighting them in the accent colour as it wraps round the far side.

  • Pro
  • Motion Effects
  • Hover
  • 3D

Props

PropTypeDefaultWhat it does
dots420Number of dots spread over the sphere.
radius130Sphere radius in px. The canvas adds room for dots pushed outwards; it scales down in narrow containers.
color—Dot colour. Defaults to near-black, or near-white in dark mode.
accent—Ripple colour. Defaults to system blue.
repel55How hard the pointer pushes dots away, 0–100.
speed30Idle spin speed, 0–100.
dotSize3.4Base dot diameter in px; front dots draw larger, back dots smaller.
interactivetrueLet the pointer push dots, drag to spin and tap for ripples.
hint"Drag to spin. Tap for a ripple."Hint under the sphere. An empty string hides it.
autoplayfalseSends ripples from different points and flicks the sphere round until someone touches it.
className—Classes for the root.

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

    Dot Sphere 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 Dot Sphere works

parts the dots as it passes. Drag to spin it in any direction and let go dots and lighting them in the accent colour as it wraps round the far side.

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

Dot Sphere questions

How do I install Dot Sphere?

Run `npx shadcn@latest add @nexus-labs/dot-sphere`. It adds the component and 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).

Which props change the sphere?

`dots` (default 420), `radius` in px (130) and `dotSize` (3.4) set its size and density. `speed` (30) is the idle spin and `repel` (55) is how hard the pointer pushes dots, both 0 to 100. `color` and `accent` override the dot and ripple colors.

How does it respond to the pointer and keyboard?

The pointer pushes dots away, dragging spins the sphere, and a tap sends a ripple. When focused, the arrow keys spin it and Enter or Space sends a ripple. Set `interactive` to false to turn all of this off, including the hint.

Does it respect prefers-reduced-motion?

Yes. It is drawn on a 2D canvas, and framer-motion is used only to read the setting. With reduced motion on, it renders without the idle spin and ripples are disabled; dragging or the arrow keys still turn it step by step.

Does it keep animating when it is off screen?

No. The animation loop stops when the canvas scrolls out of view or the browser tab is hidden, and it resumes when it is visible again.