Pass the heading and a target. Pair it with useDeviceHeading for a live phone compass.
heading-dial.tsx
CompassDial
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| heading | number | null | — | The heading in degrees: where the device faces (0 is north, clockwise). Feed it from useDeviceHeading, a GPS course, or any source. null or no value: no heading yet. |
| target | number | null | — | The target bearing in degrees, controlled. null: no target. |
| default | number | null | null | The first target, uncontrolled. Default null. |
| on | — | Each new target: a press or drag on the ring, a key. null when Delete clears it. | |
| on | — | The end of a change: a release or a key. Not on Escape. | |
| tolerance | number | COMPASS_TOLERANCE | The half width of "on course", in degrees. Default 3. |
| disabled | boolean | false | |
| read | boolean | false | The target shows and can be focused, but a press or a key does not change it. |
| name | string | — | The form name of the hidden range input (the target). |
| form | string | — | |
| labels | — | ||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
CompassDialRose
<svg>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <svg> attributes | — | Every other attribute goes to the <svg>, with a ref. |
CompassDialTarget
<svg>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <svg> attributes | — | Every other attribute goes to the <svg>, with a ref. |
CompassDialLubber
<svg>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <svg> attributes | — | Every other attribute goes to the <svg>, with a ref. |
CompassDialCenter
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
CompassDialValue
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
CompassDialHint
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
| Right ArroworUp Arrow | Turns the target 1° clockwise. |
|---|---|
| Left ArroworDown Arrow | Turns the target 1° back. |
| Shiftarrow keys | Turns the target to the next 15°. |
| Page UporPage Down | Turns the target 45°. |
| Home | Sets the target to north. |
| DeleteorBackspace | Clears the target. |
| Escape | Stops a drag and keeps the target from before. |
Built with
Installs with Compass Dial
- Components
- Input









