Skip to content

Number Input ​

Shared label and supporting-text behaviour with catnip-input is summarised on Inputs overview.

catnip-input-number ​

Props ​

Value & constraints ​

PropTypeDefaultOptionsDescription
modelValuenumber | nullnull—Numeric value; model-value in HTML / .modelValue in frameworks.
minnumber——Minimum value. The steppers and arrow keys stop at it; a typed value below it isn't committed and is flagged on blur.
maxnumber——Maximum value. The steppers and arrow keys stop at it; a typed value above it isn't committed and is flagged on blur.
stepnumber1—Increment/decrement amount for steppers and arrow keys. Also sets display precision: 0.1 → 1 decimal, 0.01 → 2, 1 → integers.
placeholderstring""—Shown when modelValue is null.

Digit grouping & decimals ​

PropTypeDefaultOptionsDescription
separateAtnumber——Group the integer part every N digits from the right. Omit or 0 = off.
separatorstring",",, ., (space)Thousands separator when separateAt > 0. Must differ from decimalSeparator.
decimalSeparatorstring".",, .Character between integer and fractional parts (e.g. 1,5 vs 1.5).

Field presentation ​

PropTypeDefaultOptionsDescription
labelstring""—Visible field label when the label slot is empty.
optionalbooleanfalse—When true and not required, shows the localized optional hint.
optionalTextstring""—Overrides the localized optional hint (HTML: optional-text).
infostring""—Info tooltip beside the label; when non-empty, it wins over the label.suffix slot.
alignment"left" | "center" | "right""left"left, center, rightHorizontal alignment of the field label block.
requiredMarkerstring"*"—Visual marker for required fields (HTML: required-marker).
requiredScreenReaderTextstring""—Optional screen-reader supplement; it does not replace required on the control (HTML: required-screen-reader-text).
supportingTextSupportingTextProp""—One or more helper or validation messages. Each object requires text; intent accepts neutral, danger, warning, or success, and icon accepts a Catnip icon name. See supporting-text examples.

State ​

PropTypeDefaultOptionsDescription
size"s" | "m" | "l""m"s, m, lControl heights 32px, 40px, and 48px with corresponding typography.
intent"neutral" | "danger" | "warning" | "success""neutral"neutral, danger, warning, successSemantic state applied to field and supporting-text styling; danger sets aria-invalid on the input.
disabledbooleanfalse—Disables the control and steppers.
readonlybooleanfalse—Read-only control and steppers.
requiredbooleanfalse—Native required and label marker.
inputNumberAriaLabelstring""—aria-label when there is no visible label.
ariaDescribedbystring""—IDs of elements in the page, or in the shadow root the element sits in, that describe the field. They're resolved there and connected to the inner control by element reflection, read before the supporting text.

Advanced ​

PropTypeDefaultOptionsDescription
inputNumberIdstring""—DOM id for the input. Auto-generated when omitted.
namestring""—Native name for form submission.
inputNumberAutofocusbooleanfalse—Forwards native autofocus to the input; use sparingly.
autocompletestring""—Input purpose for autofill (WCAG 1.3.5), for example postal-code. Empty leaves it unset.
hideLabelbooleanfalse—Visually hides the label row; label still names the spinbutton.
testSelectorsTestSelectorsPropSee Test Selectors—Overrides stable data-test values.

Events ​

NamePayloadDescription
update:modelValuenumber | nullValue changed (unformatted number): a valid number in range while typing, null when cleared, or a step. Text that isn't a valid number in range isn't emitted.

Slots ​

Label row ​

NameDescription
labelCustom label content; falls back to label prop.
label.actionTrailing action in the label row (e.g. link).
label.suffixCustom label suffix (suffix slot); used only when info is empty.

Test selectors ​

AttributeDefaultApplies to
rootcatnip-input-numberField wrapper
controlcatnip-input-number-controlThe native text input
decrementButtoncatnip-input-number-decrementDecrease (−) button
incrementButtoncatnip-input-number-incrementIncrease (+) button
supportingTextcatnip-input-supporting-textSupporting message

Catnip Design System by Signicat