Number Input
Use catnip-input-number when users enter a single numeric value with optional stepper controls. For plain text, email, password, or textarea, use Input. For multiple string tags, use Chip Input.
Behaviour
- State: Bind
model-value/.modelValueasnumber | null. Clear the field to emitnull; useplaceholder(default"0") for empty-state hint text only. - Bounds: Set
minandmaxfor validation and to disable − / + at the limits. - Step:
stepcontrols button and arrow-key increments (default1) and max fractional precision (0.1→ up to 1 decimal,0.01→ up to 2). Values round to that precision on blur and after stepping. While typing, decimals are not padded (e.g.3stays3until you type.24or use a stepper). - Decimals: Set
decimal-separatorto,or.for display and typing (default.). - Grouping: Use
separate-at="3"withseparator=","for thousands-style display. Grouping applies on blur and after stepper clicks.separatoranddecimal-separatormust not be the same character when grouping is enabled.
Composition (shared with Input)
- Labels:
labelprop orlabelslot;label.action/label.suffixmatch Input. For custom controls, use Field Label standalone. - Supporting text: Pass
supporting-texton the host—do not mountFieldSupportingTextmanually.
Intents and status
The intent prop matches Input: neutral, warning, danger (aria-invalid), success. See Input — Guidelines — Intents and Status.
Best practices
- Prefer
min/maxover only app-level validation when the allowed range is known upfront. - Enable grouping for large integers users read often (account balances, counts); omit it for short codes or PIN-like values.
- Do not rely on
placeholderalone for required fields—userequiredand visible labels.