Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Metal Orbs, animated React component

  • Pro
  • Shaders

Two liquid-metal metaballs shaded per pixel with a fake chrome reflection on a 2D canvas. They bulge toward each other and pool when they meet; switch between joined, apart and orbit, or drag the cool orb around.

Props

PropTypeDefaultWhat it does
width440Canvas width in px.
height280Canvas height in px.
autoplayfalseCycles joined, orbit and apart by itself until someone interacts.

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

    Metal Orbs 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 Metal Orbs works

Two liquid-metal orbs drawn as metaballs. Every frame computes a field over a low-resolution buffer, derives a surface normal from its gradient, and shades it with a fake chrome environment (sky above, dark horizon, warm ground). When the orbs get close their fields add up and the surfaces bulge into each other.

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

Metal Orbs questions

How do I install Metal Orbs?

Run `npx shadcn@latest add @nexus-labs/metal-orbs`. It installs framer-motion, which is only used for the sliding highlight on the joined, apart and orbit switcher. 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).

Does Metal Orbs use WebGL or a shader?

No. Each frame it computes a metaball field on a half-resolution buffer, derives a surface normal from the field and shades it with a fake chrome reflection, then draws it to a 2D canvas with requestAnimationFrame. Because this runs on the CPU, a larger `width` and `height` costs more per frame.

How do I change the size or the starting motion?

Pass `width` and `height` in px (defaults 440 and 280). It starts in the "apart" mode, and `autoplay` cycles through joined, orbit and apart every 2.6 seconds until someone clicks the canvas or a mode button.

Can visitors interact with the orbs?

Yes. Pressing and dragging on the canvas pulls the left, blue-tinted orb around, and the right one bulges toward it when they get close; the three mode buttons are real buttons with `aria-pressed`. The canvas has an `aria-label` describing the two orbs, and the floor shadows adjust when the page has the `dark` class on the html element.