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
| Prop | Type | Default | What it does |
|---|---|---|---|
| dots | number | 420 | Number of dots spread over the sphere. |
| radius | number | 130 | Sphere radius in px. The canvas adds room for dots pushed outwards; it scales down in narrow containers. |
| color | string | — | Dot colour. Defaults to near-black, or near-white in dark mode. |
| accent | string | — | Ripple colour. Defaults to system blue. |
| repel | number | 55 | How hard the pointer pushes dots away, 0–100. |
| speed | number | 30 | Idle spin speed, 0–100. |
| dotSize | number | 3.4 | Base dot diameter in px; front dots draw larger, back dots smaller. |
| interactive | boolean | true | Let the pointer push dots, drag to spin and tap for ripples. |
| hint | string | "Drag to spin. Tap for a ripple." | Hint under the sphere. An empty string hides it. |
| autoplay | boolean | false | Sends ripples from different points and flicks the sphere round until someone touches it. |
| className | string | — | Classes for the root. |
Add it to your project
- 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 createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 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:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand 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}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
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.