Input API
View componentThe full prop reference for the Input component. A styled text input with focus ring and invalid state.
Import
import { Input } from '@structyl/styled';Props
Input
Plain styled text input with support for size variants, disabled state, and invalid aria states. Supports all standard HTML input attributes except 'size' (which is overridden as a variant prop).
| Prop | Type | Default |
|---|---|---|
| size# | 'sm' | 'md' | 'lg'Visual size variant controlling height, padding, and font size | 'md' |
| className# | stringAdditional CSS classes merged with variant styles | — |
| type# | stringHTML input type (e.g. 'text', 'email', 'password', 'number', 'file') | — |
| value# | stringControlled value (requires onChange handler) | — |
| defaultValue# | stringDefault uncontrolled value | — |
| onChange# | (e: React.ChangeEvent<HTMLInputElement>) => voidCallback fired when input value changes | — |
| placeholder# | stringPlaceholder text shown when input is empty | — |
| disabled# | booleanDisables the input and applies disabled styling | — |
| aria-invalid# | booleanMarks input as invalid for ARIA accessibility and applies invalid styling | — |
| required# | booleanMarks input as required | — |
| id# | stringUnique identifier for the input | — |
| name# | stringName attribute for form submission | — |
| autoComplete# | stringHTML autocomplete attribute value | — |
| readOnly# | booleanMakes input read-only | — |
| ref# | React.Ref<HTMLInputElement>Forward ref to underlying HTML input element | — |
InputGroup
Wrapper component that arranges an input with optional icon/element slots and left/right addon text (like domain prefixes/suffixes). Composes with Input children.
| Prop | Type | Default |
|---|---|---|
| startElement# | React.ReactNodeIcon or element shown inside the input on the left side | — |
| endElement# | React.ReactNodeIcon or element shown inside the input on the right side | — |
| leftAddon# | React.ReactNodeText or element attached outside the input on the left (e.g. 'https://') | — |
| rightAddon# | React.ReactNodeText or element attached outside the input on the right (e.g. '.com') | — |
| className# | stringAdditional CSS classes for the wrapper div | — |
| children# | React.ReactNodeInput element(s) to wrap; typically an Input component | — |
| ref# | React.Ref<HTMLDivElement>Forward ref to the wrapper div element | — |
ClearableInput
Input variant that includes a built-in clear button (X icon) shown when the input has a value. Extends Input props.
| Prop | Type | Default |
|---|---|---|
| value# | stringControlled input value | — |
| onChange# | (e: React.ChangeEvent<HTMLInputElement>) => voidCallback fired when input value changes | — |
| onClear# | () => voidCallback fired when clear button is clicked | — |
| clearIcon# | React.ReactNodeCustom icon element for the clear button; defaults to an X icon | — |
| size# | 'sm' | 'md' | 'lg'Visual size variant controlling height, padding, and font size | 'md' |
| className# | stringAdditional CSS classes merged with variant styles | — |
| defaultValue# | stringDefault uncontrolled value | — |
| placeholder# | stringPlaceholder text shown when input is empty | — |
| disabled# | booleanDisables the input and applies disabled styling | — |
| ref# | React.Ref<HTMLInputElement>Forward ref to underlying HTML input element | — |
Source code
If you didn't find what you need here, read the component implementation .