Searching Puzzle Pieces

Type to search Puzzle Pieces.

Number Field

The general-purpose numeric form field — label, hint or error, and ARIA wiring like Field, around a numeric input with a ▲/▼ stepper. Bounds are optional and the field may be left empty, so it emits a number or null. Distinct from Quantity Input, which is an always-clamped e-commerce stepper.

Current: 3

Installation

Copy the piece into your app — it compiles with your build and the code is yours:

puzzle add piece number-field

Requires the pieces.css tokens merged into your app styles (see Introduction).

Usage

import NumberField from '@/components/ui/NumberField.pzl';
<NumberField label="Quantity" value={ qty } min={ 0 } max={ 20 } step={ 1 } @change={ setQty } />

Decimals and precision

Current: 68.5

Bounds

With a min and max, typing past a bound clamps on commit and the matching stepper button disables at the edge.

1–5 · Current: 3

Empty allowed

Unbounded and optional — clearing the field emits null instead of snapping back to a number, so validation stays the parent's job.

Emitted: null

Error

Must be 18 or older

Disabled

Keyboard

With the input focused:

  • Up / Down arrows — increment or decrement by step
  • Page Up / Page Down — increment or decrement by largeStep (defaults to 10× step)
  • Home / End — jump to min / max (when bounded)
  • Enter — commit and clamp the typed value
  • Blur — commit and clamp on leaving the field

Current: 40