Input
Input is the single-line text field. It takes every native <input> prop except size, which is the size token.
InputMask, InputCurrency and
InputDate render it, so they share its sizes, states and icon slot.When to use
- Collecting free text: names, e-mails, passwords, search terms.
- A field needs validation feedback (
variant="error"or"success").
- The text spans several lines — use
TextArea. - The value comes from a list — use
SelectorInputSelect. - The value has a fixed format (phone, money, date) — use
InputMaskor its siblings.
Usage
const [name, setName] = useState('');
<Input aria-label="Name" placeholder="Type your name" value={name} onChange={(e) => setName(e.target.value)} />;Leave value undefined to use the input uncontrolled with defaultValue.
Sizes
<Input size="compact" placeholder="compact" />
Each size reads theme.component.input.size.<size> (py, fontSize, borderRadius, height); override one field
with createTheme({ component: { input: { size: { medium: { py: 'small' } } } } }).
Icons and states
<Input iconPosition="left" icon={<Icon icon={search} />} />
<Input variant="error" />
<Input variant="success" />error and success show a status icon when no icon is set. Without any variant, a native constraint (required,
pattern, …) paints the error border once the user has interacted (:user-invalid); an explicit variant, including
'default', turns that off. Field always passes one.
Clearing
clearable shows a clear button while there is a value and the input is not readOnly. Standalone, pass reset to
clear your state; inside a Form, Field injects it.
<Input clearable value={value} onChange={(e) => setValue(e.target.value)} reset={() => setValue('')} />Accessibility
Inputrenders no label: wrap it inFieldor passaria-label.- The clear button is a native
<button>reachable withTab, named byclearLabel(defaultLimpar).
Properties
clearablebooleannoneclearLabelstring'Limpar'iconanynoneiconPosition"right""left"'right'onChange((e: ChangeEvent<HTMLInputElement, Element>) => void)nonereset(() => void)nonesize"expansive""medium""compact""micro"'medium'valuestringnonevariant"default""success""error"'default'Placement props (area, alignSelf, justifySelf) apply to the wrapper.