Input & TextArea
Single-line and multi-line text inputs with web-first API
Input and TextArea use web-standard form APIs and translate them to React Native behavior on iOS and Android.
Installation
Input is already installed in tamagui, or you can install it independently:
yarn
npm
bun
pnpm
Usage
A single-line text input:
For multi-line text input, use TextArea:
Web-first API
The v2 Input uses standard HTML input attributes.
Input types
Use the standard HTML type attribute. On native, these automatically map to the appropriate keyboard and behavior:
Cross-platform mapping:
Web type | Native behavior |
|---|---|
password | secureTextEntry={true} |
email | keyboardType="email-address" |
tel | keyboardType="phone-pad" |
number | keyboardType="numeric" |
url | keyboardType="url" |
search | inputMode="search" |
- Web
type password- Native behavior
secureTextEntry={true}- Web
type email- Native behavior
keyboardType="email-address"- Web
type tel- Native behavior
keyboardType="phone-pad"- Web
type number- Native behavior
keyboardType="numeric"- Web
type url- Native behavior
keyboardType="url"- Web
type search- Native behavior
inputMode="search"
Enter key behavior
Use enterKeyHint to control the enter/return key label on virtual keyboards:
On native, this automatically maps to returnKeyType.
Form attributes
Standard HTML form attributes work:
Events
Use standard web events:
For convenience, onChangeText is still supported but deprecated:
Submit handling
To handle form submission on enter:
Styling
Input accepts all Tamagui style props and supports the size prop for consistent scaling:
Native-only props
Some props only apply on native platforms and have no web equivalent:
keyboardAppearance (iOS): Controls the keyboard color scheme on iOS:
textContentType (iOS): Provides hints for iOS autofill:
For web autofill, use the standard autoComplete attribute instead.
Cross-platform text behavior
These props work on both web and native with automatic value conversion:
autoCorrect
Controls automatic spelling correction:
autoCapitalize
Controls automatic text capitalization. Native values provide more granular control:
Migration from v1
If you’re migrating from v1 Input, here are the key changes:
| v1 (React Native style) | v2 (Web style) |
|---|---|
secureTextEntry | type="password" |
keyboardType="email-address" | type="email" |
keyboardType="phone-pad" | type="tel" |
keyboardType="numeric" | type="number" |
keyboardType="url" | type="url" |
returnKeyType="search" | enterKeyHint="search" |
editable={false} | readOnly or disabled |
onChangeText | onChange |
multiline | Use TextArea or rows > 1 |
numberOfLines | rows |
- v1 (React Native style)
secureTextEntry- v2 (Web style)
type="password"- v1 (React Native style)
keyboardType="email-address"- v2 (Web style)
type="email"- v1 (React Native style)
keyboardType="phone-pad"- v2 (Web style)
type="tel"- v1 (React Native style)
keyboardType="numeric"- v2 (Web style)
type="number"- v1 (React Native style)
keyboardType="url"- v2 (Web style)
type="url"- v1 (React Native style)
returnKeyType="search"- v2 (Web style)
enterKeyHint="search"- v1 (React Native style)
editable={false}- v2 (Web style)
readOnlyordisabled- v1 (React Native style)
onChangeText- v2 (Web style)
onChange- v1 (React Native style)
multiline- v2 (Web style)
- Use
TextAreaorrows > 1 - v1 (React Native style)
numberOfLines- v2 (Web style)
rows
The v1 props still work but are deprecated. We recommend updating to the web-standard props for better cross-platform consistency.
API reference
Input props
Accepts all HTML <input> attributes plus Tamagui style props.
Props
size
'xs' | 'sm' | 'md' | 'lg' | 'xl' | SizeTokens
Scale the input size consistently.
type
"text" | "password" | "email" | "tel" | "number" | "url" | "search"
HTML input type. Automatically maps to native keyboard types.
enterKeyHint
"enter" | "done" | "go" | "next" | "previous" | "search" | "send"
Hint for the enter key label. Maps to returnKeyType on native.
placeholderTextColor
ColorTokens
Color of placeholder text. Accepts Tamagui color tokens.
selectionColor
ColorTokens
Color of text selection. Accepts Tamagui color tokens.
onSubmitEditing
(e: { nativeEvent: { text: string } }) => void
Called when enter/return is pressed.
keyboardAppearance
"default" | "light" | "dark"
iOS only. Controls keyboard color scheme.
textContentType
string
iOS only. Hints for autofill. Use autoComplete for web.
TextArea props
Accepts all Input props plus:
Props
rows
number
Number of visible text lines.