Live globe
NewThe world as a dot grid in Orbit's hand-drawn style, with a teal pin wherever someone is browsing the shop right now. The live instrument at the top of the home page in Orbit Commerce's store dashboard.
Playground
Drag to turn it. With zoom on, click a pin to fly in to that country and anywhere else to fly out.
<LiveGlobe
markers={visitors}
size={360}
zoomable
zoomOutHint="Click anywhere to zoom out"
title="Live visitors"
/>Markers
A visitor does not get a pin of their own: the land dot nearest to them lights up, so pins sit on the map's own grid. Live visitors ping; recent ones sit faint. A chip names the place nearest the front, with a count when more than one person is there.
Pass one marker per place, not per session: group sessions within about 11km (a city) and set count. With countryCode, pins close together roll up into one per country when the globe is zoomed out.
| Field | Type | What it does |
|---|---|---|
lat | number | Latitude. 0,0 is not a real place: leave unknown locations out. |
lng | number | Longitude. |
live | boolean | Browsing right now: the pin pings. Without it the pin sits faint. |
label | string | The city, or the country when the city is unknown. Shown in the chip. |
count | number | Sessions at this place. Shown in the chip as "London · 3". |
countryCode | string | ISO 3166-1 alpha-2, e.g. "GB". Lets nearby pins roll up per country. |
arrivedAt | number | The performance.now() of the newest arrival here. Drives one wide flash. |
Arrivals
When someone new lands, give their marker an arrivedAt and change focus to their place with a new key: the globe eases round to face them and their pin flashes.
The globe swings round to the new visitor, and their pin flashes one wide ring on top of its steady ping.
Holding still
When everyone is in one place, pass it as holdAt: the globe eases there and stops spinning, so the view stays where the action is. A drag still works and is respected afterwards.
still
still draws the globe once and holds it: no spin and no pulsing pins. For thumbnails, print and anywhere motion would only distract. It still turns on drag.
In both themes
Land dots in ink, pins in the accent: teal in light, mint in dark. Chips sit on the canvas colour.
Sizing
size is the canvas; the sphere is 0.76 of it, leaving room for chips and the zoom hint. So a 520px canvas draws a world about 400px across. The canvas is drawn at a fixed pixel size, so when its column changes width, measure it and pass a new size (in steps, as the store dashboard's home page does in 20px steps) rather than scaling it with CSS.
width makes the canvas wider than tall, which gives a zoomed-in map room to breathe. safeInset keeps chips clear of a top and bottom band a parent may clip.
| Canvas | World | Use |
|---|---|---|
| 520px | about 400px | The home hero on a desktop. |
| 400px | about 300px | Laptops and tablets beside the takings. |
| 300px | about 230px | Phones, leading the page. |
| 120 to 180px | about 90 to 140px | Thumbnails, with still. |
Theming
The canvas reads four custom properties at draw time. They map to tokens, so the globe follows light, dark and any ThemeScope around it. Set them on a parent to restyle one globe.
| Property | Default | Paints |
|---|---|---|
--o-globe-ink | --o-fg-1 | The land dots (at 8 to 70% strength by depth), chip borders and chip text. |
--o-globe-accent | --o-accent | Pins, pings, the arrival flash and journey arcs. |
--o-globe-halo | --o-bg-canvas | The disc behind each pin and the chip fill. Match it to the surface. |
--o-globe-font | --o-font-sans | Chip and hint lettering. |
Guidelines
- Show real sessions only. A dashboard that invents visitors is lying to the merchant; sample data for review must be labelled as such.
- One globe per page, as the hero. Several spinning globes compete and cost battery.
- Pins are teal because they are live. Do not colour them by status, device or anything else.
- Leave it room. It needs its full square; crop it only through safeInset, never by clipping the sphere.
Accessibility
- It is a canvas. Without
zoomableoronClickit is hidden from assistive tech as a picture; with either it becomes a button named bytitle. - Pins and chips are drawn, so everything they say must also be written on the page: the browsing count, and a Live View page for the detail.
- A sideways drag turns it; an up or down swipe still scrolls the page on a phone.
- With reduced motion it holds still and the pins stop pulsing; it still turns on drag.
- It pauses when scrolled off screen and rests when nothing is moving, so an idle tab costs nothing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
markers | GlobeMarker[] | [] | One per place. See Markers above. |
size | number | 200 | Canvas height in px (and width, unless width is set). The sphere is 0.76 of it. |
width | number | None | Canvas width, for a wider-than-tall map. Defaults to size. |
focus | { lat, lng, key } | null | None | Change the key to ease the globe round to that place. |
holdAt | { lat, lng } | null | None | Park on this place and stop spinning. |
zoomable | boolean | false | Click a pin to zoom in on it; click elsewhere to zoom out. |
zoomOutHint | string | None | Shown while zoomed in, e.g. "Click anywhere to zoom out". |
onClick | () => void | None | A tap (not a drag) with nothing zoomed, e.g. to open Live View. |
title | string | None | Tooltip and accessible name while interactive. |
safeInset | number | 0 | A top and bottom band the parent may clip; chips stay clear of it. |
still | boolean | false | Draw once and hold still. For thumbnails and print. |