Skip to content
SevenUI
Sign in
On this page

Number Field

Displays a number field built on the Base UI Number Field primitive.

Installation

Bash

Usage

Features

  • ScrubArea with Pointer Lock: The NumberFieldScrubArea component enables drag-to-adjust functionality using Pointer Lock API. Drag horizontally to increase or decrease the value. Note: Pointer Lock is not available in Safari.
  • Number Formatting: Use the format prop (accepts Intl.NumberFormatOptions) to customize how numbers are displayed in the input field.
  • Stepper Buttons: Increment and decrement buttons for precise value adjustments.
  • Step Values: Configure step for regular increments, smallStep for fine adjustments (e.g., mouse scroll), and largeStep for large jumps (e.g., shift+scroll).

Examples

Currency

format takes Intl.NumberFormatOptions; largeStep applies while holding Shift. Drag the label to scrub the value.

Quantity

A compact stepper clamped with min and max.

API reference

Number Field is a Base UI exclusive — shadcn/ui has no equivalent component. The parts compose explicitly, as in the demo above.

NumberField

Extends the Base UI Number Field Root — all its props apply.

PropTypeDefault
value / defaultValuenumber | null—
onValueChange(value: number | null) => void—
min / maxnumber—
stepnumber1
largeStepnumber — step while holding Shift10
formatIntl.NumberFormatOptions—
disabledbooleanfalse

NumberFieldGroup, NumberFieldInput, NumberFieldIncrement, NumberFieldDecrement

Styled Base UI parts: the group draws the bordered container, the input holds the formatted value, and the stepper buttons come with their plus/minus icons built in (hold to repeat).

NumberFieldScrubArea

Wraps a label to make it scrubbable — dragging it adjusts the value with a pointer-lock cursor.

Was this page helpful?