Radar
A sweeping radar where blips flare as the beam passes.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/radar.jsonUsage
import { Radar } from "@/components/ui/radar"
<Radar blips={[{ angle: 40, distance: 0.6, label: "BAW 117" }]} />Examples
Moving contacts
Update the blips as often as you like. Each one stays in step with the sweep at its new bearing.
Contact colors
Give a blip its own color to classify it.
Device scan
A small scope with unlabeled blips makes a friendly scanning state.
API reference
Radar
Renders a div with role="img" and accepts its attributes; the ref points at it.
| Prop | Type | Default |
|---|---|---|
blips | RadarBlip[]Contacts on the scope. | [] |
speed | numberSeconds per revolution. | 4 |
rings | numberRange rings, evenly spaced. | 4 |
size | "sm"200, 280 or 360px across, or a diameter in pixels. It stays square and shrinks to fit a narrower container; a w-* class also works. | "md" |
label | stringAccessible name. The contact count and labeled contacts are appended. | "Radar" |
color | NeonColorPhosphor color. Falls back to --neon-accent, then cyan. | inherited |
RadarBlip
| Prop | Type | Default |
|---|---|---|
angle | numberBearing in degrees, clockwise from the top. | None |
distance | numberDistance from the center, 0 to 1. | None |
label | stringShort tag beside the blip, also read to screen readers. | None |
color | NeonColorThis blip's color. Defaults to the radar's. | None |
Accessibility
- The scope is one image to screen readers, named like "Approach radar: 5 contacts. BAW 117 at bearing 038, 62% range…". Pass aria-label to replace it.
- Everything moves with CSS animations on transform and opacity, so there is no per-frame JavaScript. The blips' clocks are pinned to the sweep's in an effect.
- With reduced motion, the beam stops at a fixed bearing and each blip holds the brightness it would have at that point in the sweep.