Globe
MotionReact dotted globe drawn on a plain canvas without WebGL, with auto rotation, drag with inertia, keyboard control and labelled markers joined by arcs.
Installation
npx shadcn@latest add @minidev/globe
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/globe.json
Usage
import { Globe } from "@/components/ui/globe"
export function Example() {
return (
<Globe />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| markersPlaces to mark, in degrees. Consecutive markers are joined by arcs. | GlobeMarker[] | DEFAULT_MARKERS |
| dotsNumber of dots on the sphere. | number | 2000 |
| speedIdle spin in degrees per second. 0 holds still until dragged. | number | 6 |
| arcsJoin consecutive markers with arcs. | boolean | true |
| alignWhere the globe sits on wide panels. The demo content takes the other side. | "left""center""right" | "right" |
| colorDot colour. Any CSS colour, including var(--token). Defaults to the muted foreground. | string | "var(--fg-muted)" |
| accentMarker, arc and glow colour. Any CSS colour. Defaults to the accent. | string | "var(--accent)" |
| className | string | - |
| children | React.ReactNode | - |
When to use
Use it for "global reach" or "where your users are" sections. For a lighter decorative sphere of logos use IconCloud.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Focuses the globe canvas, which shows an inset accent ring. |
| ArrowLeftorArrowRight | Turns the globe sideways. |
| ArrowUporArrowDown | Tilts the globe up or down, within a fixed limit. |
Accessibility
- The canvas has
role="img"and anaria-labelbuilt from your markers, such as "Globe with markers for London, New York. Drag or use the arrow keys to rotate." - The canvas has
tabIndex={0}, so keyboard users can reach it and turn it with the arrow keys. - Under reduced motion it draws one still frame. Dragging and arrow keys still turn it, but a flick does not keep spinning.
Frequently asked questions
Is Globe WebGL or three.js?
Neither. It draws about 2,000 dots (dots) on a 2D canvas with plain trigonometry, so there is no extra dependency. It stops drawing when off screen or when the tab is hidden.
How do I mark cities and connect them?
Pass markers with lat, lng and an optional label. With arcs on (the default) each marker is joined to the next one in the array, with a pulse along each arc.
Does dragging the globe block page scroll on phones?
No. The canvas has touch-action: pan-y, so a vertical swipe scrolls the page and a sideways drag turns the globe. A quick flick keeps it spinning with inertia.
Can buttons sit on top of the globe?
Yes. The content layer ignores the pointer except on its direct children, so the globe stays draggable around your text and buttons. align moves the globe left, centre or right on panels wider than 512px.
Dependencies
npm
Built from
Examples
Custom markers
Markers take latitude and longitude with a label; consecutive ones are joined by arcs.
Centred without arcs
align center puts the globe behind the copy; arcs false leaves the markers on their own.
Colours and a still globe
color and accent take any CSS colour, tokens included; speed 0 holds still until dragged.