1. Documentation
  2. Forms
  3. Number Field
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Number Field

A numeric input with a stepper, locale formatting, and an optional scrub handle.

Loading documentation…

Textarea< PreviousOTP FieldNext >

Powered by heyo

On this page

UsageUnitsScrubbingFormattingProperties
req/s
<NumberFieldlabel="Rate limit"defaultValue={100}min={1}max={1000}step={10}suffix="req/s"/>

Use NumberField wherever an <input type="number"> would go and you care about the result. It formats with Intl.NumberFormat, clamps to min and max, steps with ↑ and ↓ (×10 with Shift, ÷10 with Alt), and never lets a stray scroll silently change the value unless you ask for allowWheelScrub.

Usage

tsx
import { NumberField } from "@heyo-sh/heyo-ui";<NumberField label="Memory" defaultValue={128} min={64} max={1024} step={64} />;

Units

suffix is a flush addon on the right edge — the unit belongs to the control, not to the label, so it stays visible while the value changes.

MB
s
<NumberField label="Memory" defaultValue={128} step={64} suffix="MB" /><NumberField label="Timeout" defaultValue={30} suffix="s" size="sm" />

Scrubbing

scrubbable adds a grip on the left edge that you drag sideways to sweep the value. It is the only comfortable way to dial a number in while watching something else update, and it costs one 20px handle.

%
<NumberField label="Opacity" scrubbable defaultValue={80} min={0} max={100} suffix="%" />

Formatting

format takes Intl.NumberFormatOptions, so currency, percentages and grouping are configuration rather than code.

<NumberFieldlabel="Budget"defaultValue={2500}step={100}format={{ style: "currency", currency: "EUR", maximumFractionDigits: 0 }}/>
A range, not a number?

When the exact figure matters less than where it sits between two bounds, use Slider. When it is a measurement you are reporting rather than collecting, use Meter.

Properties

value / defaultValuenumber | nulloptional

Controlled and uncontrolled value.

onValueChange(value: number | null) => voidoptional

Fires on every committed change.

min / maxnumberoptional

Bounds. The value is clamped to them.

stepnumber | "any"optional

The increment for the stepper and the arrow keys.

largeStep / smallStepnumberoptional

The Shift and Alt increments. They default to ten times and a tenth of step.

formatIntl.NumberFormatOptionsoptional

Currency, percent, grouping, fraction digits.

localeIntl.LocalesArgumentoptional

The locale used for formatting and parsing.

allowWheelScrubbooleanoptional

Lets the mouse wheel change the value while the field is focused. It defaults to false, on purpose.

scrubbablebooleanoptional

Adds the drag handle on the left edge. It defaults to false.

suffixReactNodeoptional

A flush addon on the right edge — req/s, GB, %.

size"xs" | "sm" | "base" | "lg"optional

Control height. It defaults to base.

label / description / error / optional / labelAsideFieldOwnPropsoptional

The same field layout every heyo-ui control composes. See Field.

disabled / readOnly / required / name—optional

Standard form behaviour, passed through to Base UI.