Skip to content
Back

Number fieldPro

A bounded number with steppers that repeat and speed up when held, a strain and a limit note at the edges, typed drafts that spring back to the limit, and digits that roll the way the value moved.

oxyn add number-field
seats
Hold + to repeat; Shift steps ten.
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • A bounded number with − and + buttons and a typed field.
  • Holding a button repeats after 400 ms, ramping from 150 ms to 40 ms a step (held_steps).
  • At a limit a press is refused: the value strains 2–8 px toward the press (further for pushes in a row, capped), the refused button shakes once and a note ("Max 10 seats", built from the prefix and suffix) rises beside the label for 1.5 s.
  • A typed draft past a limit tints the shell with the warning role and springs back to the limit on Enter or blur; an unparseable draft reverts.

When not to use

  • On or off for things that apply right away: use Switch instead.
  • A real checkbox with a label and second line, an indeterminate state for Select all, an error, a card row and a check that draws itself: use Checkbox instead.
  • Pick one: use Radio group instead.

Installation

Number field is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add number-field

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Seats

Plural suffix; press + at 10 to see the strain and the note.

seats
Hold + to repeat; Shift steps ten.
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Price

Prefix, grouping and a step of 50.

$
Hold + to repeat; Shift steps ten.
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Ratio

Decimals from the step; drag the label to scrub.

Hold + to repeat; Shift steps ten.
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Small

Small, no limit note.

seats
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

NumberField

PropTypeDefaultDescription
labelrequiredString—Label.
valuef64Default::default()Starting value.
minf64Default::default()Lower bound.
maxf641e15Upper bound.
stepf641.0Increment (its precision sets the decimals).
large_stepOption<f64>Default::default()PageUp/PageDown and Shift+arrow distance.
prefixStringDefault::default()Text before the number ("$").
suffixStringDefault::default()Text after the number (" seats").
suffix_oneOption<String>Default::default()Singular suffix (" seat") used when the value is 1.
descriptionOption<String>Default::default()Helper copy under the field.
sizeString"md"`sm` · `md` · `lg`.
scrubboolDefault::default()Drag the label sideways to change the value.
limit_hintbooltrueShow the limit note.
groupingbooltrueThousands separators.
disabledboolDefault::default()Disabled.
nowrequiredClockMs—Shared clock (hold-to-repeat and the note's timing).
on_changeEventHandler<f64>—Every committed change.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
↑or↓Step; held keys repeat
Shift↑or↓orPage UporDownLarge step
HomeorEndMin / max
EnterCommit a typed draft (clamped)
EscapeRevert the draft

Accessibility

  • The input is role=spinbutton with min, max, now and a valuetext that includes the affixes.
  • The limit note is role=status.
  • Reduced motion changes the value at once and answers a refused press with a warning tint instead of a shake.
From the spec
  • role=spinbutton with aria-valuemin/max/now and a valuetext with the affixes.
  • Steppers are tabindex −1 (the keys cover them); the note is role=status.

Motion & interaction

Timing
  • Hold repeat: first step on press, then 400 ms, then 150 ms × 0.82 per step down to 40 ms.
  • Strain: 260 ms spring (cubic-bezier .3,1.6,.5,1) back from 2 + pushes px (max 8).
  • Digits: 220 ms roll up or down per changed place.
  • Reduced motion: values change at once; a refused press tints the number with the warning role instead of the strain and shake.

Responsive behaviour

  • Widths 164, 196 and 228 px for sm, md and lg.
Edge cases (spec)
  • Widths 164 / 196 / 228 px for sm / md / lg.

Notes for AI

  • Import NumberField from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: NumberFieldEl in oxyn_gpui.
  • Props to set first: label, now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI