Input
The catnip-input component provides a versatile, highly configurable form field for standard text entry, passwords, and multiline paragraphs. Shared label and supporting-text APIs are summarised on Inputs overview.
Overview
The catnip-input component renders robust native <input> or <textarea> elements with built-in accessibility handling. Key features include:
- Input modes: Use
text(oremail),password(custom*masking with documented trade-offs for autofill and edge-case editing), ortextarea(with configurable rows). - Semantic Intents: Apply
neutral,warning,danger, orsuccessstates to automatically adjust borders, focus rings, and supporting text colors. - Supporting Text: Built-in integration with the internal
FieldSupportingTextprimitive to provide descriptions, helper text, or error messages directly linked viaaria-describedby. - Flexible Icons: Slot in leading or trailing icons, and optionally make the right icon an interactive, accessible button. For single-line
text/email,show-clear-buttonadds a trailing clear control while the value is non-empty (uses bundledinput.clearunlessclear-button-aria-labelis set); it hides the plainrightIconwhile visible.
Live example
Accessibility
- IDs & Labeling: Automatically generates fallback
idattributes if omitted, ensuring the native control is always addressable. Provides robustaria-describedbylinkage to supporting text. - Invalid State: When
intent="danger"is set,aria-invalid="true"is automatically applied to the underlying input for assistive technology. - Interactive Icons: If the generic right icon is clickable (
rightIconClickable), a validrightIconButtonAriaLabelis strictly required. Theshow-clear-buttontrailing control usesclear-button-aria-labelor the defaultinput.clearlabel. - Password masking: Uses manual JS masking on a
type="text"input so the visible mask is*; see Input — Guidelines — Password for autofill and editing caveats.