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; steppers and typing are clamped on commit.
maxnumber——Maximum value; steppers and typing are clamped on commit.
stepnumber1—Increment/decrement amount for steppers and arrow keys. Also sets display precision: 0.1 → 1 decimal, 0.01 → 2, 1 → integers.
placeholderstring"0"—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.
ariaLabelstring""—aria-label when there is no visible label.
ariaDescribedbystring""—Extra id values merged into aria-describedby alongside generated supporting-text ids.

Advanced ​

PropTypeDefaultOptionsDescription
idstring""—DOM id for the input. Auto-generated when omitted.
namestring""—Native name for form submission.
autofocusbooleanfalse—Autofocus (use sparingly).
hideLabelbooleanfalse—Hides the built-in label row.
testSelectorsTestSelectorsPropSee Test Selectors—Overrides stable data-test values.

Events ​

NamePayloadDescription
update:modelValuenumber | nullValue changed (unformatted number).

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