Skip to content
Design System
GitHub

Number field

v0.17.2Beta

A number with a range, a step and a unit. Type freely, kept in range on blur; 44 px buttons; arrow keys, Shift, PageUp/PageDown, Home/End.

0.2 to 2.0 m/s. Shift+↑↓ moves by 1.0

Number field speed

Install
npx shadcn add @syncrobotic/number-field

Also installs: lucide-react, @syncrobotic/cn, @syncrobotic/input-group

Overview

When to use

  • Speed limits, battery thresholds, intervals, counts.
  • Any value with limits the user should not exceed.

Use something else

  • A rough value where precision does not matter: Slider.
  • A number with no range, like an ID: Input with inputMode numeric.

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

Minutes, large steps

Between 15 and 240 minutes

Percent

Between 10 and 50 %.

Count, no unit

1 to 6

Below zero

−10 to 10 degrees

Number field kinds

Error

Must be at least 10 %, or the robot may not reach the dock

Disabled

Can’t change during a mission

Number field states

Usage rules

  • The value and its unit are one reading, centred between − and +: write the unit with unit, not in the label.
  • For a number with a range and a unit: speed, thresholds, intervals. For a free number with no range, Input with inputMode="numeric" is enough.
  • Never block typing. The value is kept in range when the field loses focus, and the hint says the range.
  • ↑↓ step, Shift or PageUp/PageDown step by largeStep, Home/End go to the limits. The buttons are for touch and skip the Tab order.

Changelog

  • 0.17.22026-11-19A comment says where keyboard focus shows instead of the removed outline (no change in behaviour); checked by lint:rules.
  • 0.15.02026-11-19The value and its unit are one reading, centred between − and + ("20 %"), instead of the value in the middle and the unit by the + button; the value is as wide as its digits. Angles sit on the number ("-2.5°"). A press anywhere in the middle puts the caret in the value.
  • 0.10.02026-11-18Disabled keeps its words readable: a grey field (bg-muted, muted text) on controls with a surface, solid disabled ink on items and icons; no more 50 % opacity, which washes text out in sunlight.

How to upgrade