Weftv0.4.0
GitHubFigma
Blade AI
Inputs · NumberInputstable

Number input

Sets a whole number inside a range by typing it or stepping with − and +, such as seats on a plan. Three sizes; square, flat and token-driven.

Preview

#preview

Switch size, validation and state. The React and CSS tabs update with the preview.

Between 1 and 50 seats.

size medium · min 1 · max 50 · helpText
seats-input.tsx
import { NumberInput } from "@blade-ai/weft/components/number-input";

export function SeatsField({ seats, onSeats }: Props) {
  return (
    <NumberInput
      label="Seats"
      min={1}
      max={50}
      value={seats}
      onChange={({ value }) => onSeats(value)}
      helpText="Between 1 and 50 seats."
    />
  );
}

All states

#all-states

Every state from the Number Input matrix, shown at size medium.

Number Input · 11 states · size medium · read-only look and pressed token: UNDEFINED

Between 1 and 50 seats.

Default

Between 1 and 50 seats.

Hover

Between 1 and 50 seats.

Focus-visible

Between 1 and 50 seats.

Pressed (+)

Between 1 and 50 seats.

Read-only

Between 1 and 50 seats.

Disabled

Between 1 and 50 seats.

At min (− disabled)

Between 1 and 50 seats.

At max (+ disabled)
Invalid

Between 1 and 50 seats.

Small

Between 1 and 50 seats.

Large

Props

#props

Booleans are is-prefixed. max is required; min defaults to 0. One of label or accessibilityLabel is required.

Prop
Type
Default
Description
label
string
—
Visible text above the field, rendered as a <label> tied to the input. Required unless accessibilityLabel is passed.
accessibilityLabel
string
—
Name when there is no visible label (cart and table rows). Becomes aria-label.
value
number
—
Controlled value. Use with onChange. Sets aria-valuenow.
defaultValue
number
—
Initial value when uncontrolled. Ignored if value is set. Defaults to min.
min
number
0
Lowest value. − and Down stop here; Home jumps here. Sets aria-valuemin.
max *
number
—
Highest value. + and Up stop here; End jumps here. Sets aria-valuemax. Always set it.
step
number
1
Amount added or removed by −, +, Up and Down. Greater than 0.
largeStep
number
10
Amount for PageUp and PageDown. Default amount: UNDEFINED · needs decision (10 proposed).
onChange
({ value, name, event }) => void
—
Fires with the new number after typing, a ± press or a step key. Not fired when disabled or read-only. Required when controlled.
name
string
—
Form field name. The number is sent with the form.
size
"small" | "medium" | "large"
"medium"
Height 32 · 36 · 48 with value text 12 · 14 · 16.
helpText
ReactNode
—
Hint under the field, linked with aria-describedby. State the range here.
errorText
ReactNode
—
Shown when validationState is "error"; replaces helpText.
validationState
"none" | "error"
"none"
"error" draws the negative border and sets aria-invalid.
isDisabled
boolean
false
Not focusable, not submitted, 50% opacity. ± buttons are inert.
isReadOnly
boolean
false
Focusable and submitted, but the value cannot change; ± and step keys do nothing. Sets aria-readonly="true". Visual treatment: UNDEFINED · needs decision.
isRequired
boolean
false
Must hold a value to submit. Sets aria-required. Visual marker: UNDEFINED · needs decision.
autoFocus
boolean
false
Focuses the value text field on mount, never a ± button.
testID
string
—
Test selector on the input (data-testid).

Usage

#usage

Short rules for number fields.

Do
Use role="spinbutton" or <input type="number"> with a real <label> and aria-valuenow, aria-valuemin, aria-valuemax.
Always set min and max, and state the range in help text.
Keep − and + out of the tab order (tabindex="-1") and name them "Decrease" and "Increase".
Disable − at min and + at max, drawn with --interactive-icon-gray-disabled.
Use only the Theme tokens listed under States; Global tokens only for size, spacing, radius, type.
Clear the error as soon as the value becomes valid; strip non-numeric characters on paste.
Don't
Don't add component tokens (no numberInput/*); add a Theme token or flag UNDEFINED.
Don't round the field or the buttons: Weft uses --border-radius-none.
Don't show the focus ring on mouse click; use :focus-visible on the field.
Don't make − and + tab stops, or move focus to them on click.
Don't use Number Input for amounts, IDs or named options; use Text input or Select.
Don't replace the value input with plain text; the value must stay typeable.

Accessibility

#accessibility

A spinbutton field with two inert-to-Tab buttons.

Keyboard
Key
Action
Tab / Shift+Tab
To / from the value field; ± skipped (tabindex="-1"); disabled skipped, read-only kept.
Up / Down
+ step / − step, kept inside min to max. No-op when read-only or disabled.
PageUp / PageDown
+ largeStep / − largeStep, kept inside min to max.
Home / End
Set min / set max.
Digits / paste
Edit as text; paste strips non-numeric characters.
Enter
Submits the form (native).
Click − / +
One step; focus stays where it was.
ARIA
Element
Role / attribute
When
<input>
role="spinbutton" · inputmode="numeric" · aria-valuenow · aria-valuemin · aria-valuemax
Always
<input>
<label for> or aria-label = accessibilityLabel
label · accessibilityLabel (only when there is no label)
<input>
aria-describedby = id of helpText, or of errorText when invalid
Help or error text shown
<input>
aria-invalid="true"
validationState = error
<input>
aria-readonly="true" · aria-required="true" · disabled
isReadOnly · isRequired · isDisabled
Decrease button
aria-label="Decrease" (+ label, e.g. "Decrease seats") · tabindex="-1"
Always
Increase button
aria-label="Increase" (+ label, e.g. "Increase seats") · tabindex="-1"
Always
± button
aria-disabled="true"
− at min, + at max

Agent Spec

#agent-spec

Machine-readable spec, tables (a)–(g). Same source as /specs/number-input.json and llms.txt.

/specs/number-input.json·component: "NumberInput"·package: "@blade-ai/weft"·updated 2026-11-24
PropertyValueToken
Height · ± width32 · 36 · 48size.32 · size.36 · size.48
Value width40 · 48 · 48size.40 · size.48 · size.48
Icon size · stroke (viewBox 16)14 · 16 · 20 · 1.5 · 1.5 · 1.25size.14 · size.16 · size.20
Border · radius1px · 0border.width.thin · border.radius.none
Value font size / line height12/16 · 14/20 · 16/22fonts.size.75 · 100 · 200 / lineHeights.50 · 100 · 1200
Label font size · weight14 · mediumfonts.size.100 · fonts.weight.medium
Label → field and field → help gap6spacing.15
Help / error font size / line height12/16fonts.size.75 / lineHeights.50
Touch target on mobile48 on large (± squares)size.48