Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Dot Globe, animated React component

  • Pro
  • 3D Components
  • 3D
  • Spring

A dotted globe with flight arcs drawing themselves along great circles. Drag to spin it and it coasts to a stop; pick a city and it springs round to face you.

Props

PropTypeDefaultWhat it does
size340Width and height of the globe canvas in px.
accent"#0071e3"Colour of the arcs, pins and the selected city chip.
citiesDOT_GLOBE_CITIESCities to pin and list as chips. Each has id, name, lat and lon.
routesDOT_GLOBE_ROUTESFlight arcs as pairs of city ids; pairs with an unknown id are skipped.
autoplayfalseTurns slowly and tours the cities until someone drags or picks one.

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 Globe 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 Globe works

True when the point (degrees) is on land, as far as the outline can tell.

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

Dot Globe questions

How do I install the Dot Globe?

Run `npx shadcn@latest add @nexus-labs/dot-globe`. It installs framer-motion only; the globe is drawn on a 2D canvas with its own projection math, so it does not use three.js 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 add my own cities and flight routes?

Pass `cities` as `{ id, name, lat, lon }` objects and `routes` as pairs of city ids, for example `[["ber", "nyc"]]`. A route that names an unknown id is skipped. The defaults are the exported `DOT_GLOBE_CITIES` and `DOT_GLOBE_ROUTES`.

Does it draw continents or a real map?

No. The 1,600 dots sit on an even lattice over the whole sphere, so the globe has no land shapes. Only your city pins and the great-circle arcs between them carry geographic meaning, which suits a flight or office-network visual rather than a map.

How do I control the size and color, and how does interaction work?

`size` is the square canvas size in px (default 340) and `accent` colors the arcs, pins and selected chip (default `#0071e3`). Dragging spins the globe and it coasts to a stop, and clicking a city chip springs the globe round to it. The chips are buttons with `aria-pressed`, so they give keyboard users a way to rotate it, and the canvas has `role="img"` with a label naming the selected city.