Globe
A dotted neon globe on canvas with real coastlines, pulsing markers and lit arcs. Drag or use arrow keys to spin.
New in 1.7.
Median time to first byte, last 24 h
14ms
- Washington, D.C.iad1 · 9 ms
- Frankfurtfra1 · 12 ms
- Singaporesin1 · 17 ms
- Cape Towndraining
Writes commit in iad1 and reach six replicas in under 140 ms. Drag the globe to look around.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/globe.jsonUsage
import { Globe } from "@/components/ui/globe"
<Globe
markers={[
{ id: "fra", lat: 50.03, lng: 8.57, label: "fra1" },
{ id: "sin", lat: 1.36, lng: 103.99, label: "sin1" },
]}
arcs={[{ from: "fra", to: "sin" }]}
/>Examples
Routes and a graticule
Arcs take [lat, lng] pairs as well as marker ids. The graticule draws every 15°.
Decoration
Not interactive and spinning slowly: an image with a label, out of the tab order.
API reference
A canvas in a square, round box. Size it with a width class; it keeps its aspect.
| Prop | Type | Default |
|---|---|---|
markers | GlobeMarker[]{ id?, lat, lng, label?, live? }. Labels draw beside the point and are read to screen readers; live: false draws a dim point with no pulse. | [] |
arcs | GlobeArc[]{ from, to }, each a marker id or [lat, lng]. Great-circle arcs lifted off the surface, each with a pulse of light. | [] |
speed | numberAuto-rotation in degrees per second. 0 holds it still. | 6 |
longitude | numberLongitude facing the viewer at the start. | 10 |
tilt | numberLatitude at the centre of the view; positive looks down on the north. | 20 |
interactive | booleanDrag to spin with inertia, and arrow keys when focused. | true |
arcDuration | numberSeconds for a pulse to cross an arc. | 2.6 |
graticule | booleanParallels and meridians every 15°. | false |
color | NeonColorColor of the land, rim, arcs and markers. | inherited |
Accessibility
- Interactive globes are a focusable group with a 'globe' role description and instructions linked by aria-describedby. Left and Right turn 15° (45° with Shift), Up and Down tilt 10°, Home resets the view.
- The accessible name lists the labelled markers, so the locations are available without seeing the canvas. Pass aria-label to say more.
- The land is a 1° grid from Natural Earth's 1:110m coastline, about 3 kB in the file. No three.js, no WebGL, no fetch.
- Dots are spaced about 5.5 pixels apart at any size and drawn in six batches by depth, so a frame is a handful of fills.
- Drawing stops off screen and in background tabs. With reduced motion it draws one still frame; dragging and the arrow keys still turn it, without inertia.
- Touch drags turn it sideways only; vertical swipes still scroll the page.