TextInput()function
TextInput({
name,
title = "",
placeholder = title, // Placeholder must be defined or `:placeholder-shown` CSS rules won't show.
required = false,
disabled = false,
message = "",
value,
onValue,
input = "text",
min = 0,
max = Number.POSITIVE_INFINITY,
rows = 1,
formatter = PASSTHROUGH,
...variants
}: TextInputProps): ReactElement| Param | Type | |
|---|---|---|
variants | TextInputProps | Props for TextInput, a single- or multi-line text input bound to a string value. required |
.rows | number | |
.multiline | boolean | |
.input | StringInputType | type="" prop for HTML <input /> tags that are relevant for strings. |
.min | number | |
.max | number | |
.formatter | TextFormatter | Optional formatter — when provided the value is reformatted on blur and when initially displayed. |
| Return | |
|---|---|
ReactElement | A text <input> or <textarea> element. |
Text input bound to a string value, rendered as an <input> or a <textarea> when rows > 1.
- Applies an optional
formatteron initial display and on blur. - Multiline mode auto-grows the textarea to fit its content.
Examples
<TextInput name="name" value={name} onValue={setName} />