Components

Globe

An interactive 3D globe for React built on WebGL with cobe: pin markers by latitude and longitude, draw arcs between cities, and let visitors drag it around with spring momentum. Neutral land dots with mint markers by default, sharp on high-DPI screens, responsive, and paused whenever it's off-screen.

  • WebGL
  • Markers & arcs
  • Drag with momentum
  • Keyboard rotation
  • Pauses off-screen
  • Reduced-motion safe

Every deploy reaches nine regions

Drag the globe to spin it, or focus it and use the arrow keys.

  • San Francisco
  • New York
  • São Paulo
  • London
  • Frankfurt
  • Mumbai
  • Singapore
  • Tokyo
  • Sydney

Installation

$ npx shadcn@latest add https://duskui.com/r/globe.json

The globe is square and fills the width of its parent up to max-w-[600px]; override it with className. Colors accept any CSS color, including theme variables like var(--color-primary).

Usage

network.tsx
import { Globe } from "@/components/dusk/globe/globe"

export function Network() {
  return (
    <Globe
      className="max-w-md"
      markers={[
        { location: [37.77, -122.42], label: "San Francisco" },
        { location: [51.51, -0.13], label: "London" },
        { location: [35.68, 139.65], size: 0.08, label: "Tokyo" },
      ]}
    />
  )
}

Examples

Arcs

Pass arcs with from and to coordinates to draw routes. Each marker and arc can set its own color; phi and theta set the starting rotation and tilt.

Arcs

Connect locations with curved arcs. The hub marker overrides the default color with its own.

  • Berlin (hub)

Colors and static globes

Retint with baseColor, glowColor and markerColor. Set autoRotate and draggable to false for a still globe; the render loop then stops entirely after the first frame.

Custom colors
Static: no rotation or dragging

API Reference

Any other div prop is passed to the root. Markers and arcs update in place without rebuilding the WebGL context; changing a color, phi, theta or the map settings rebuilds it.

PropTypeDefaultDescription
markersGlobeMarker[][]Points to pin: { location: [lat, lng], size?, color?, label? }.
arcsGlobeArc[][]Curved routes: { from: [lat, lng], to: [lat, lng], color? }.
autoRotatebooleantrueSpin on its own. Always off under reduced motion.
speednumber0.2Auto-rotation speed in radians per second.
draggablebooleantrueRotate by dragging (with momentum) and with the arrow keys.
phinumber0Starting longitude rotation in radians.
thetanumber0.25Tilt toward the viewer in radians.
baseColorstring"oklch(0.4 0 0)"Color of the land dots.
markerColorstring"var(--color-primary)"Default marker color.
glowColorstring"oklch(0.18 0 0)"Soft rim light. Keep it close to the background.
arcColorstring"oklch(0.7 0 0)"Default arc color.
darknumber11 for a dark globe, 0 for a light one.
diffusenumber1.2Lighting falloff toward the edges.
mapBrightnessnumber6Brightness of the land dots.
mapSamplesnumber16000Number of dots drawn for the map. Lower is lighter.
labelstring"Interactive globe"Accessible name.
fallbackReactNode—Shown instead of the globe when WebGL is unavailable. Defaults to a soft CSS sphere.

Accessibility

  • The globe has an accessible name (label), and markers with a label are listed for screen readers.
  • When draggable it is focusable: the arrow keys rotate and tilt it (hold Shift for bigger steps).
  • With prefers-reduced-motion it never auto-rotates and drags move it directly, without momentum.
  • Rendering stops while the globe is off-screen or the tab is hidden, and the WebGL context is released on unmount.
  • Without WebGL a static fallback keeps the layout intact.