Selection and input

TextField

Text input with a label, for secure entry and errors too.

iOSSwiftUI TextField / SecureFieldAndroidCompose OutlinedTextFieldRenders in a Screen or an Island
iOSSwiftUI TextField / SecureField
AndroidCompose OutlinedTextField

Import

ts
import {TextField} from '@hzblj/kara-ui'

Props

An uncontrolled text field with an optional label above it — SwiftUI TextField (SecureField when secure) / Compose OutlinedTextField.

PropTypeDefaultDescription
defaultValuestring''

The text it starts with. Read once, on mount — the field is uncontrolled.

disabledbooleanfalse

Stops editing and dims the field. On iOS it outranks error.

errorbooleanfalse

Marks the field invalid: a destructive outline and label.

labelstring—

Shown above the field, in labelMedium.

multilinebooleanfalse

Wraps the text and grows the field to fit it. iOS ignores it when secure.

onChangeText(text: string) => void—

Called with the whole text after every change.

securebooleanfalse

Masks the text, for a password.

testIDstring—

iOS: forwarded to the native field. Android ignores it.

defaultValue''
string

The text it starts with. Read once, on mount — the field is uncontrolled.

disabledfalse
boolean

Stops editing and dims the field. On iOS it outranks error.

errorfalse
boolean

Marks the field invalid: a destructive outline and label.

label
string

Shown above the field, in labelMedium.

multilinefalse
boolean

Wraps the text and grows the field to fit it. iOS ignores it when secure.

onChangeText
(text: string) => void

Called with the whole text after every change.

securefalse
boolean

Masks the text, for a password.

testID
string

iOS: forwarded to the native field. Android ignores it.

Platform notes

  • Uncontrolled: start it with defaultValue and read changes from onChangeText.