Skip to content

Input ​

catnip-input ​

Props ​

Shared field behaviour with catnip-input-date, catnip-input-number, catnip-input-phone, and catnip-input-chip is summarised on Inputs overview. The sections below are the full catnip-input reference, grouped by what you are trying to configure.

Value & form ​

PropTypeDefaultOptionsDescription
modelValuestring | number""—Value of the input; model-value in HTML / .modelValue in frameworks.
inputIdstring""—DOM id for the input. If omitted, an id is generated.
namestring""—Native name for form submission.
requiredbooleanfalse—Native required and label marker.

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.

Input behaviour ​

PropTypeDefaultOptionsDescription
typestring"text"text, email, password, textareaInput type.
placeholderstring""—Placeholder when empty.
autocompletestring"on"—Native autocomplete.
inputAutofocusbooleanfalse—Forwards native autofocus to the input; use sparingly.
inputSpellcheckbooleanfalse—Forwards native spellcheck to the input.
maxlengthnumberundefined—Max length.
patternstringundefined—Validation pattern.
inputmodeCatnipInputModeundefinednone, text, decimal, numeric, tel, search, email, urlOn-screen keyboard hint (HTML inputmode), for example numeric for a one-time code or postcode. Unset uses the type's default.
rowsnumberundefined—For textarea; default rows depend on size.
resizablebooleantrue—For textarea; vertical resize.

State & validation ​

PropTypeDefaultOptionsDescription
size"s" | "m" | "l""m"s, m, lDimensions and 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.
readonlybooleanfalse—Read-only control.
inputAriaLabelstring""—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.

Adornments & actions ​

PropTypeDefaultOptionsDescription
leftIconCatnipIconName | """"CatnipIconNameLeading icon.
rightIconCatnipIconName | """"CatnipIconNameTrailing icon; remains visible after the clear control when both are present.
rightIconClickablebooleanfalse—Makes the trailing icon a button; requires rightIconButtonAriaLabel when not password.
rightIconButtonAriaLabelstring""—Accessible label for the trailing icon button.
showClearButtonbooleanfalse—For text / email, shows a clear control before any trailing icon while the value is non-empty (not password).
clearButtonAriaLabelstring""—Accessible label for clear; defaults to bundled input.clear.

Advanced ​

PropTypeDefaultOptionsDescription
hideLabelbooleanfalse—Visually hides the label row; label still names the control.
testSelectorsTestSelectorsPropSee Test Selectors—Overrides stable data-test values.

Events ​

NamePayloadDescription
update:modelValuevalue: string | numberValue changed.
right-icon-click—Generic trailing icon button (not password toggle or clear).

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.

Input adornments ​

NameDescription
leftIconSlotCustom leading icon.
rightIconSlotCustom trailing icon.

See Component API — Slots.

Test selectors ​

AttributeDefaultApplies to
rootcatnip-inputSingle-line: bordered wrapper. Textarea: use control (same node as the field).
controlcatnip-input-controlThe native <input> or <textarea>.
leftAdornmentcatnip-input-left-adornmentLeading icon region (when present).
clearButtoncatnip-input-clearClear control (when showClearButton and value non-empty).
rightButtoncatnip-input-right-buttonRight icon button (password toggle or rightIconClickable).
supportingTextcatnip-input-supporting-textSupporting message below the field.

For Date Input (catnip-input-date), see Date Input — Specs. For Number Input (catnip-input-number), see Number Input — Specs. For Phone Input (catnip-input-phone), see Phone Input — Specs. For Chip Input (catnip-input-chip), see Chip Input — Specs.

Catnip Design System by Signicat