Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Bubble Cluster, animated React component

  • Pro
  • Motion Effects
  • Spring

Contacts packed into one cluster of soft, tinted bubbles sized by how close they are, over a faint liquid backdrop. Switch groups and everyone springs to new places and sizes while people outside the group shrink away. Hover a bubble to read how close that person is.

Props

PropTypeDefaultWhat it does
people12 sample contactsEveryone who can appear, as { id, name, hue }; hue (0-360) tints the bubble.
groupsFamily, Close friends, WorkGroup name to { person id: closeness 1-5 }. Closeness sets bubble size; people left out of a group hide in it.
gap5Space between bubbles, 0 to 24.
sizeContrast1How much closeness changes size, 0 to 2. 0 makes every bubble the same size; higher makes the closest people much bigger.
bounce1How bouncy the bubbles are when they move, 0.5 to 2.5. Lower is smooth and settled, higher wobbles.
liquid1Strength of the faint liquid backdrop, 0 to 4. 0 hides it.
autoplayfalseSteps through the groups every 2.6s until someone presses the cluster or the switcher.

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

    Bubble Cluster 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 Bubble Cluster works

Contacts packed into one bubble cluster, sized by how close they are. Switch groups and everyone springs to new positions and sizes (the closest people move first), people outside the group shrink away, and a faint liquid backdrop re-forms around the cluster. Hover a person to read how close they are.

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

Bubble Cluster questions

How do I install Bubble Cluster?

Run `npx shadcn@latest add @nexus-labs/bubble-cluster`. It installs framer-motion; the bubbles are plain DOM elements and there is no canvas or WebGL. 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).

How do I pass my own contacts and groups?

Give `people` as `{ id, name, hue }` objects and `groups` as an object of group name to `{ personId: closeness }`, with closeness from 1 to 5. A bigger number gives a bigger bubble, and anyone left out of a group shrinks away when that group is selected.

Which props tune the look and the motion?

`gap` is the space between bubbles in px (default 5, range 0 to 24), `sizeContrast` is how much closeness changes size (default 1, range 0 to 2), `bounce` is how springy the movement is (default 1, range 0.5 to 2.5) and `liquid` is the strength of the backdrop (default 1, 0 hides it). `autoplay` steps through the groups every 2.6 seconds until someone presses the cluster or the switcher.

How is the gooey backdrop made, and is it accessible?

The positions come from a small circle-packing function and the backdrop is blurred circles passed through an SVG `feGaussianBlur` and `feColorMatrix` filter, all animated with Framer Motion springs. Bubbles are a `role="list"` with labels like "Mom, 5 of 5 close" and the group switcher is made of buttons with `aria-pressed`, but the bubbles themselves are not focusable.