components / 34

marked number field

numbers respond to more than typing. drag the label, hold a stepper, use the wheel, or press a modified arrow key.

shadcnnpx shadcn@latest add berkantay/cheez/marked-number-field
live

tune the voice, not just the value

48px
drag the label, type, or hold a stepper

human
measure.

12 / 120 px
ink
size
character
raw value48
<MarkedNumberField
  value={typeSize}
  onValueChange={(value) => setTypeSize(value ?? 12)}
  min={12}
  max={120}
  step={2}
  tone="orange"
>
  <MarkedNumberFieldScrubArea>
    <MarkedNumberFieldLabel>type size ↔</MarkedNumberFieldLabel>
  </MarkedNumberFieldScrubArea>
  <MarkedNumberFieldGroup>
    <MarkedNumberFieldDecrement />
    <MarkedNumberFieldInput />
    <MarkedNumberFieldIncrement />
  </MarkedNumberFieldGroup>
</MarkedNumberField>
format

raw values can speak locally

Intl.NumberFormat
currency
percent
unit
states

the boundary explains the constraint

invalid, readonly, disabled
must be 120 or less
locked by the grid
unavailable now
reference

api

Base UI arithmetic, Cheez pressure
partproptypedefaultpurpose
Rootvaluenumber | nullcontrolled raw value
RootonValueChangefunctioncontinuous value callback
RootonValueCommittedfunctionblur or pointer-release callback
Rootmin / maxnumberrange constraints
Rootstepnumber | "any"1button, key, and scrub step
RootsmallStep / largeStepnumber0.1 / 10Alt and Shift modifiers
RootformatIntl.NumberFormatOptionslocale-aware presentation
RootallowWheelScrubbooleanfalsewheel changes while focused
RootsnapOnStepbooleanfalsesnap interactive changes
Rootinvalidbooleanfalsecontrolled Cheez error state
ScrubAreadirection"horizontal" | "vertical""horizontal"drag axis
ScrubAreapixelSensitivitynumber2drag distance per step
Inputaria-labelstringaccessible name without label

behavior notes

  • typing, paste, keys, wheel, steppers, and scrubbing report distinct change reasons
  • pressing and holding either stepper repeats the change
  • Alt uses smallStep; Shift uses largeStep
  • formatted text and raw numeric value stay separate
  • the hidden native number input carries form constraints and submission value
  • parsing, clamping, pointer lock, and repeat behavior come from Base UI
  • no Framer Motion is shipped