Coordinate reference field

Two or three numeric coordinate axes with supplied units and a reference selector that preserves entered values when assigning a reference.

Recorded survey point

Assigning a reference keeps the entered coordinates. Conversion is handled by the application.

Coordinate reference

site

Assign the survey reference

Survey import / Point 042

Recorded point

Assigning a reference keeps the entered coordinates. Conversion is handled by the application.

Coordinate reference

Local reference supplied with the survey

The record now uses the site grid. Assigning a reference preserves the entered numbers.

Use it for

  • Survey points and imported coordinates whose reference, axis order and units are supplied by the application.
  • Supply two or three axes in coordinate order with unique, non-empty identifiers; reference values must also be unique and non-empty.
  • Use value and onValueChange for application-owned conversion. Changing the reference requests only a new identifier and preserves the numeric coordinates.
  • name submits reference as name.reference and each axis as name.coordinates followed by its identifier. null represents a missing coordinate or reference.

Not for

  • Inferring a reference from numeric ranges, treating a reference assignment as reprojection or guessing axis units.
  • Using a latitude or longitude bound for a projected axis unless the application supplies that constraint.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { CoordinateReferenceField } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/coordinate-reference-field.

2. Vendor the source

npx @noorddev/vlak-cli add coordinate-reference-field

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/coordinate-reference-field.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { CoordinateReferenceField } from "@noorddev/vlak-react";

<CoordinateReferenceField
  label="Recorded survey point"
  name="point"
  axes={[{ id: "east", label: "Easting", unit: "m" }, { id: "north", label: "Northing", unit: "m" }]}
  references={[{ value: "site", label: "Site grid" }, { value: "project", label: "Project grid" }]}
  defaultValue={{ reference: "site", coordinates: { east: 120.5, north: 48.25 } }}
/>

CoordinateReferenceField

Numeric coordinates and an explicitly assigned reference, without implicit conversion.

PropTypeDefaultDescription
labelrequiredReactNode
axesrequiredreadonly CoordinateReferenceAxis[]Two or three axes in the supplied coordinate order. Units are never inferred.
referencesrequiredreadonly CoordinateReferenceOption[]
valueCoordinateReferenceValue
defaultValueCoordinateReferenceValueinitial
onValueChange(value: CoordinateReferenceValue) => voidAssigning a reference preserves every numeric value. The host owns reprojection.
descriptionReactNode
referenceLabelstring"Coordinate reference"
unknownReferenceLabelstring"Unknown reference"
requiredboolean
readOnlyboolean

Also accepts Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "defaultValue">.

KeysDoes
TabMoves through the reference selector and coordinate inputs in supplied axis order.
Arrow keys, Home, EndOpens and navigates the Vlak selector. Enter or Space chooses a reference without converting numeric values; Escape closes the menu.
TypingEdits numeric coordinates using the native number inputs.
<fieldset class="rs-coordinate-reference-field"><legend class="rs-coordinate-reference-field-legend">Survey point</legend><p class="rs-coordinate-reference-field-note">Assigning a reference keeps the entered coordinates.</p><div class="rs-coordinate-reference-field-label"><span id="geo-coordinate-reference-label">Coordinate reference</span><div class="rs-select rs-select-fluid rs-coordinate-reference-field-control"><button type="button" class="rs-dropdown" role="combobox" aria-labelledby="geo-coordinate-reference-label" aria-expanded="false" aria-haspopup="listbox">Site grid</button></div></div><div class="rs-coordinate-reference-field-axes"><label class="rs-coordinate-reference-field-label">Easting (m)<input class="rs-input rs-input-full rs-coordinate-reference-field-control" name="point.coordinates.east" type="number" step="any" value="120.5" /></label><label class="rs-coordinate-reference-field-label">Northing (m)<input class="rs-input rs-input-full rs-coordinate-reference-field-control" name="point.coordinates.north" type="number" step="any" value="48.25" /></label></div></fieldset>
.rs-coordinate-reference-field.rs-coordinate-reference-field-legend.rs-coordinate-reference-field-axes.rs-coordinate-reference-field-label.rs-coordinate-reference-field-control.rs-coordinate-reference-field-note