Cabin comfort
Both zones
Adjust in half-degree steps. Increase sits above decrease.
Edits a numeric value with native validation, units, and bounded 44px increase and decrease actions.
Both zones
Adjust in half-degree steps. Increase sits above decrease.
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { NumberField } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/number-field.
npx @noorddev/vlak-cli add number-field
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/number-field.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { NumberField } from "@noorddev/vlak-react";
<NumberField label="Cabin temperature" name="temperature" defaultValue={20} min={16} max={28} step={0.5} unit="°C" controlsPlacement="stacked" />Numeric input with native validation and bounded increment/decrement actions.
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | null | ||
defaultValue | number | null | null | |
onValueChange | (value: number | null) => void | ||
min | number | ||
max | number | ||
step | number | 1 | |
label | ReactNode | ||
unit | string | ||
incrementLabel | string | "Increase value" | |
decrementLabel | string | "Decrease value" | |
controlsPlacement | "inline" | "stacked" | "inline" | Stack the increase button above decrease at the end of the field. |
Also accepts Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "size" | "min" | "max" | "step">.
| Keys | Does |
|---|---|
| Tab | Moves between the number field and available step actions. |
| Arrow up, Arrow down | Uses the browser's native numeric stepping while the input is focused. |
| Enter, Space | Activates a focused increase or decrease button. |
<div class="rs-number-field"><label class="rs-number-field-label" for="cabin-temperature">Cabin temperature</label><div class="rs-number-field-row"><input class="rs-input rs-number-field-input" id="cabin-temperature" type="number" min="16" max="28" value="20" aria-describedby="cabin-unit" /><span class="rs-number-field-unit" id="cabin-unit">°C</span><div class="rs-number-field-controls"><button class="rs-btn-ghost rs-number-field-action" type="button" aria-label="Decrease value">−</button><button class="rs-btn-ghost rs-number-field-action" type="button" aria-label="Increase value">+</button></div></div></div>