Text Input
Give your project a name you’ll recognize.
Give your project a name you’ll recognize.
A single-line labeled text field with optional helper text, error, icon and clear button.
A Markdown brief for Claude, Cursor or v0: install, setup, props and a complete example.
For one line of free text: a name, an email, a URL.
Several lines? Text Area. A fixed set of answers? Select or Choice.
The label is always tied to the field, even when hidden. Helper text and errors are announced with it, and an error sets aria-invalid.
import { TextInput } from '@idyeah/diya'Stable since 1.0.0
labelRequiredstringVisible label above the input; also its accessible name. Hide it with hideLabel.
clearablebooleanShows a clear button while there is text; it empties the value and refocuses the input.
Default false
defaultValuestringThe starting text when uncontrolled; a form reset returns to it.
errorstringVisible error message below the input; marks the field invalid while set.
helperTextstringVisible hint below the input, announced with it; error replaces it while set.
hideLabelbooleanHides the label visually but keeps it as the input's accessible name.
Default false
leadingIconReactNodeDecorative icon inside the input's start edge; hidden from assistive tech.
onValueChange(value: string) => voidCalled with the new text on every edit and when cleared.
size"small" | "medium" | "large"Control height and type size; defaults to 'medium'.
Default 'medium'
valuestringThe current text when controlled; pair it with onValueChange.
Also takes every native <input> attribute, such as name, id or data-*.