Overview
Reference usage
Numeric text input with increment and decrement stepper controls.
Usage
By default the number is reported when the field is left, when Enter is pressed, or by a stepper. Set commitWhileTyping to report each number as it is typed, for a field whose value writes through at once; text that is not a number yet (a lone -) is held until the field is left, leaving the field reports nothing for a number (it was reported as it was typed, so a value shown rounded is not changed by a visit), and an emptied field reports null without marking a required field invalid while it has focus.
Value: 1
When to use
- Collecting a bounded numeric value such as a quantity, price, or age.
- Needing locale-aware display formatting on top of a native number input.
- Selecting a value within a continuous range visually — use slider instead.
- Collecting free-form text or non-numeric content — use input instead.
Examples
Basic number input
Numeric field with label, bounds, and a committed-value display.
Props
Name | Type | Default | Description |
|---|---|---|---|
id required | text | HTML id for the underlying input, used to associate the <label> and ARIA attributes. Required. | |
value bindable | number | null | Bindable current numeric value, or null when the field is empty. |
min | number | Minimum permitted value; the stepper decrement button disables when this bound is reached. | |
max | number | Maximum permitted value; the stepper increment button disables when this bound is reached. | |
step | number | Amount added or subtracted per stepper click or arrow-key press. Default 1. | |
format | Intl.NumberFormatOptions | Locale-aware formatting options passed to Intl.NumberFormat.
Supports all Intl.NumberFormatOptions properties such as style
('decimal', 'currency', 'percent', 'unit'), currency,
minimumFractionDigits, maximumFractionDigits, and notation.
Defaults to locale-standard decimal formatting when omitted. | |
locale | text | BCP 47 locale tag used for number formatting and parsing. Defaults to the
nearest LocaleProvider locale, then navigator.language after mount and
en-US during server rendering. | |
disabled | boolean | When true, disables the input and stepper buttons, matching the native disabled attribute. | |
required | boolean | Marks the input as required for form validation, matching the native required attribute. | |
name | text | Name used to identify this field's value in form data. | |
label | text | Visible label text rendered above the input and linked via for/id. | |
description | text | Helper text rendered below the input and associated via aria-describedby. | |
error | text | Error message rendered below the input; also sets aria-invalid on the input. | |
inputAttachment | Attachment<HTMLInputElement> | Attachment for native input access and lifecycle-scoped listeners. | |
adornment | text | Optional non-interactive adornment rendered before the stepper controls. | |
size | 'sm' | 'md' | 'lg' | 'md' | Height step from the shared --cinder-control-height-* scale: sm 28px, md 32px,
lg 40px, the same heights as an Input of that size. Replaces the native character-width
size attribute, which Cinder does not forward. |
quietBorder | InputProps['quietBorder'] | Uses the shared quiet resting boundary for an outlined settings control. | |
commitWhileTyping | boolean | false | Reports each number as it is typed, not only when the field is left or Enter is pressed. Text
that is not a number yet (such as -) is not reported and does not mark the field invalid
until the field is left. Leaving the field reports nothing for a number, because it was
reported as it was typed, so a value shown rounded is not changed by a visit. |
onValueChange | (value: number | null) => void | ||
onblur | FocusEventHandler<T> | undefined | null |