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.
idstring""DOM id for the input. If omitted, an id is generated.
namestring""Native name for form submission.
requiredbooleanfalseNative required and label marker.

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.

Input behaviour

PropTypeDefaultOptionsDescription
typestring"text"text, email, password, textareaInput type.
placeholderstring""Placeholder when empty.
autocompletestring"on"Native autocomplete.
autofocusbooleanfalseAutofocus (use sparingly).
spellcheckbooleanfalseNative spellcheck.
maxlengthnumberundefinedMax length.
patternstringundefinedValidation pattern.
rowsnumberundefinedFor textarea; default rows depend on size.
resizablebooleantrueFor textarea; vertical resize.

State & validation

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

Adornments & actions

PropTypeDefaultOptionsDescription
leftIconstring""CatnipIconNameLeading icon.
rightIconstring""CatnipIconNameTrailing icon (hidden while showClearButton is active and the value is non-empty).
rightIconClickablebooleanfalseMakes the trailing icon a button; requires rightIconButtonAriaLabel when not password.
rightIconButtonAriaLabelstring""Accessible label for the trailing icon button.
showClearButtonbooleanfalseFor text / email, shows a clear control while the value is non-empty (not password).
clearButtonAriaLabelstring""Accessible label for clear; defaults to bundled input.clear.

Advanced

PropTypeDefaultOptionsDescription
hideLabelbooleanfalseHides the built-in label row when a parent field renders the label.
testSelectorsobjectSee Test SelectorsOverrides for data-test.

Events

NamePayloadDescription
update:modelValuevalue: string | numberValue changed.
rightIconClickGeneric 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).
trailingButtoncatnip-input-trailing-buttonTrailing 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