TextField
Text input with a label, for secure entry and errors too.
Import
import {TextField} from '@hzblj/kara-ui'Props
An uncontrolled text field with an optional label above it — SwiftUI TextField (SecureField when secure) / Compose OutlinedTextField.
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | string | '' | The text it starts with. Read once, on mount — the field is uncontrolled. |
| disabled | boolean | false | Stops editing and dims the field. On iOS it outranks |
| error | boolean | false | Marks the field invalid: a destructive outline and label. |
| label | string | — | Shown above the field, in |
| multiline | boolean | false | Wraps the text and grows the field to fit it. iOS ignores it when |
| onChangeText | (text: string) => void | — | Called with the whole text after every change. |
| secure | boolean | false | Masks the text, for a password. |
| testID | string | — | iOS: forwarded to the native field. Android ignores it. |
The text it starts with. Read once, on mount — the field is uncontrolled.
Stops editing and dims the field. On iOS it outranks error.
Marks the field invalid: a destructive outline and label.
Shown above the field, in labelMedium.
Wraps the text and grows the field to fit it. iOS ignores it when secure.
Called with the whole text after every change.
Masks the text, for a password.
iOS: forwarded to the native field. Android ignores it.
Platform notes
- Uncontrolled: start it with
defaultValueand read changes fromonChangeText.