Mobile › Inputs

TextField

A labelled text input with a hint and an error message. The label always stays visible.

Installation

npx expo install plankui-mobile react-native-safe-area-context expo-haptics

Usage

import { TextField } from "plankui-mobile";

const [email, setEmail] = useState("");

<TextField
  label="Email"
  placeholder="[email protected]"
  keyboardType="email-address"
  autoCapitalize="none"
  value={email}
  onChangeText={setEmail}
  hint="We only use it to sign you in."
  error={invalid ? "That doesn't look like an email address." : undefined}
/>

iOS and Android

iOS: A filled rounded field. Text stays at 16 pt or more so iOS Safari never zooms in.

Android: A Material 3 outlined field; the outline and label turn accent on focus.

API reference

PropTypeDefaultDescription
labelstringAlways visible above the field.
hintstring–Help text under the field.
errorstring–Shown instead of the hint and read out by screen readers.
inputStyleStyleProp<TextStyle>–Style for the input itself.
refRef<TextInput>–To focus the field from code.
...TextInputPropsTextInputProps–Any React Native TextInput prop: value, onChangeText, keyboardType, secureTextEntry...