How it works
A textbook figure of trilateration on an 18 × 7 m floor. Three anchors at known points each measure their distance to a tag, give or take a range error. Each reading puts the tag on a ring around its anchor: the measured range is drawn as a circle in the anchor's colour and the error as a pale band around it. The tag can only be where all three bands overlap, shaded in ink. The readout gives the worst case, the farthest point of that region from the tag, and the three ranges. Spread anchors cross their rings at wide angles and fix the tag within about the range error; anchors in a line cross at shallow angles, the region stretches, and a mirror image of the tag on the other side of the line fits the readings too. Drag the tag or an anchor; a press on the empty floor moves the tag there.
Use it for
- Teach how a position follows from distances, and why the placement of the anchors matters as much as the accuracy of each range.
- Show the mirror ambiguity of anchors in a line, and how one anchor moved off the line resolves it.
Look elsewhere when
- For live positions from real sensors, use a map with an estimate and its confidence: this figure shows the ideal geometry, with every range off by at most the chosen error.
Usage
import React, { useState } from 'react'
import { AnchorRangeAtlas } from './AnchorRangeAtlas.jsx'
export function PositioningLesson() {
const [points, setPoints] = useState({
a: { x: 2, y: 1.5 },
b: { x: 16, y: 1.5 },
c: { x: 9, y: 6 },
tag: { x: 11, y: 3.5 },
})
return (
<AnchorRangeAtlas
value={points}
onChange={(next, { worst }) => setPoints(next)}
defaultRangeError={0.25}
labels={{ title: 'Locate a tag from three ranges' }}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
value | { a, b, c, tag } | — | Controlled positions of the three anchors and the tag, each { x, y } in metres on an 18 × 7 m floor (rounded to 0.1). |
defaultValue | { a, b, c, tag } | { a: { x: 2, y: 1.5 }, b: { x: 16, y: 1.5 }, c: { x: 9, y: 6 }, tag: { x: 11, y: 3.5 } } | Starting positions when uncontrolled, and what Reset returns to in both modes. |
onChange | (points, reading) => void | — | Called with the new positions and { object ('a', 'b', 'c', 'tag' or null on reset), reason ('drag', 'press', 'tap', 'key', 'cancel' or 'reset'), ranges (three distances in metres), worst (the farthest possible position from the tag, in metres), area (of the possible positions, in m²) }. |
rangeError | number | — | Controlled range error in metres: each reading may be off by this much either way. The control offers 0.25, 0.5 and 1. |
defaultRangeError | number | 0.5 | Starting range error when uncontrolled, and what Reset returns to. |
onRangeErrorChange | (error, { reason }) => void | — | Called when the range error changes, with reason 'press', 'key' or 'reset'. |
labels | object | — | Replaces any built-in text: title, caption, anchor ('{name}'), tag, ring, overlap, floor, pointText ('{name}', '{point}'), rangeText ('{name}', '{point}', '{range}'), movable, readout, rangeError, unit and reset. |
locale | string | 'en' | Language tag for the numbers. |
className | string | — | Extra class on the card, for example to set its width (30rem by default, never wider than its container). |
Accessibility
- The three anchors and the tag are each one tab stop, a button with the role description 'movable point' and a name that reads its position (and, for an anchor, its range). Arrow keys move the focused point by 0.5 m, with Shift by 2 m, clamped to the floor; Escape during a drag puts it back.
- The range error is a radio group with one tab stop; arrow keys change it. Reset is a button, marked unavailable while nothing has changed.
- The readout is a polite live region: it reads the worst-case position error and the three ranges.
- Dragging uses pointer capture. A handle sets touch-action: none, so the page does not scroll while a point is dragged; on the empty floor a tap places the tag and a swipe still scrolls the page. A cancelled gesture puts the point back where it started.
- Colour is not the only key: the anchors carry their letters, the ranges in the readout are lettered, and the legend names the ring, the region and the tag.
Motion
After a key press, a tap or Reset the moved point glides for --ds-duration-fast while the rings and the region redraw at once; while a point is dragged it follows the pointer directly. With reduced motion every change lands at once.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
AnchorRangeAtlas.jsxanchor-range-atlas.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

