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 | nullnullNumeric value; model-value in HTML / .modelValue in frameworks.
minnumberMinimum value; steppers and typing are clamped on commit.
maxnumberMaximum value; steppers and typing are clamped on commit.
stepnumber1Increment/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
separateAtnumberGroup 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 label text when the label slot is empty.
optionalbooleanfalseShows optional hint on the label when not required.
optionalTextstring""Overrides optional hint text (HTML: optional-text).
infostring""Info tooltip on the label (info wins over the label.suffix slot when both are set).
alignmentstring"left"left, center, rightLabel alignment.
requiredMarkerstring"*"Visual required marker (HTML: required-marker).
requiredScreenReaderTextstring""Supplemental screen-reader text for required fields (HTML: required-screen-reader-text).
supportingTextstring | string[] | { text, intent?, icon? } | { text, intent?, icon? }[]Message(s) below the field. See Inputs overview — Multiple supporting messages.

State

PropTypeDefaultOptionsDescription
sizestring"m"s, m, lDimensions and typography.
intentstring"neutral"neutral, warning, danger, successStatus styling; danger sets aria-invalid.
disabledbooleanfalseDisables the control and steppers.
readonlybooleanfalseRead-only control and steppers.
requiredbooleanfalseNative required and label marker.
ariaLabelstring""aria-label when there is no visible label.
ariaDescribedbystring""Extra id values merged into aria-describedby (in addition to supporting-text id when supportingText is set).

Advanced

PropTypeDefaultOptionsDescription
idstring""DOM id for the input. Auto-generated when omitted.
namestring""Native name for form submission.
autofocusbooleanfalseAutofocus (use sparingly).
hideLabelbooleanfalseHides the built-in label row.
testSelectorsobjectSee Test SelectorsOverrides for data-test.

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