structyl

The full prop reference for the Input component. A styled text input with focus ring and invalid state.

Import

tsx
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).

PropTypeDefault
size#'sm' | 'md' | 'lg'

Visual size variant controlling height, padding, and font size

'md'
className#string

Additional CSS classes merged with variant styles

—
type#string

HTML input type (e.g. 'text', 'email', 'password', 'number', 'file')

—
value#string

Controlled value (requires onChange handler)

—
defaultValue#string

Default uncontrolled value

—
onChange#(e: React.ChangeEvent<HTMLInputElement>) => void

Callback fired when input value changes

—
placeholder#string

Placeholder text shown when input is empty

—
disabled#boolean

Disables the input and applies disabled styling

—
aria-invalid#boolean

Marks input as invalid for ARIA accessibility and applies invalid styling

—
required#boolean

Marks input as required

—
id#string

Unique identifier for the input

—
name#string

Name attribute for form submission

—
autoComplete#string

HTML autocomplete attribute value

—
readOnly#boolean

Makes 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.

PropTypeDefault
startElement#React.ReactNode

Icon or element shown inside the input on the left side

—
endElement#React.ReactNode

Icon or element shown inside the input on the right side

—
leftAddon#React.ReactNode

Text or element attached outside the input on the left (e.g. 'https://')

—
rightAddon#React.ReactNode

Text or element attached outside the input on the right (e.g. '.com')

—
className#string

Additional CSS classes for the wrapper div

—
children#React.ReactNode

Input 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.

PropTypeDefault
value#string

Controlled input value

—
onChange#(e: React.ChangeEvent<HTMLInputElement>) => void

Callback fired when input value changes

—
onClear#() => void

Callback fired when clear button is clicked

—
clearIcon#React.ReactNode

Custom 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#string

Additional CSS classes merged with variant styles

—
defaultValue#string

Default uncontrolled value

—
placeholder#string

Placeholder text shown when input is empty

—
disabled#boolean

Disables 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 .

structyl — Accessible React Component Library