The box where users type names, emails, passwords and messages. Learn its parts, the keyboards it opens, when errors should appear, and the inputs that break it.
50–75 min Inputs & selection iOS · Android · Web Also called: Text input, Input field, EditText
In this lesson you’ll learn what a good text field looks like on each platform, and how testers break the bad ones. For whole forms (validation timing, error summaries, server errors and real-world data), see Forms and Validation.
Part Not started
What is a text field?
A text field is a box that accepts free text from the keyboard. It can be a single line (name, email, promo code) or several lines (a review, delivery instructions). Unlike a dropdown or a toggle, the user isn’t choosing from options: they can enter any character, in any amount, in any language. That freedom is exactly what makes it risky.
You’ll usually see text fields used for:
Personal data: name, email, phone number, address.
Secrets: passwords, PINs, one-time codes.
Search: products, recipes, destinations.
Free-form content: reviews, chat messages, notes for the courier.
Numbers that aren’t really “numbers”: postcode, card number, quantity, amount.
Anatomy
Email1
7name@example.com32
We'll send your receipt here.4
Display name
Anna 🌸8
Shown on your reviews.6/206
Password
•••••7
Use at least 8 characters.5
1
Label
Tells the user what to enter. Always visible, even after typing.
2
Input area (container)
The box you tap or click. Holds the value the user types.
3
Placeholder
Optional example text inside an empty field. Disappears when you type, so it is not a label.
4
Helper text
Extra guidance below the field: format, why we need it, if it is optional.
5
Error message
Replaces the helper text when the value is wrong. Says what to fix.
6
Character counter
Shows how many characters are used out of the limit.
7
Leading / trailing icon
A hint icon (mail) or an action icon (show password).
8
Clear button
Empties the field in one tap. Shown only when there is text.
iOS calls it a text field (UITextField, or TextField in SwiftUI) and a text view for multiline. Android developers say EditText, while Material Design says text field. On the web it’s an <input> element (or <textarea> for multiline). In bug reports, use the name your team uses.
Check this part
Why is a text field riskier to test than a dropdown?
With a dropdown the user picks from fixed options. A text field accepts anything, and that freedom is where the bugs hide.
The user has to choose a country from a fixed list. Which component fits better than a text field?
A dropdown picks one value from a fixed list, so there is nothing to mistype.
A box for free text from the keyboard, on one line or several, and how it differs from search fields, dropdowns, combo boxes and date pickers.
Part Not started
Designs & variants
Each platform has its own look. The parts are the same, but the risks differ: a floating label can overlap autofilled text, a left-hand label can truncate, a field with no visible label can confuse everyone.
Every field below is live: click, type, clear, and tab through them. Use the switch to compare light and dark.
Delivery address
Grouped form
iOS
Rows inside a rounded group, like Settings. The label sits on the left, so long labels and large text are the risk here.
As shown on your ID
Filled text field
Android · Material 3
Tinted box with an underline. The label floats up when you focus or type. Watch for labels overlapping autofilled text.
Outlined text field
Android · Material 3
The floating label cuts into the border. A leading icon hints at the content; the clear button appears once you type.
We'll send your order updates here.
Label above
Web
The most common web pattern. The label never moves, which makes it the easiest to read and to test.
At least 8 characters
Password with show/hide
All
The eye button reveals the password. Check it toggles both ways and that the value is never lost when you switch.
Search field
iOS
No visible label, so the placeholder and the icon do the job. Screen readers still need a name ('Search').
32/80
Multiline with counter
Android · Material 3
For longer text. The counter counts characters the way people see them. Go over the limit to see the error.
Can't be changed after ordering.
A postcode has 5 digits, like 10000.
Disabled and error states
Web
Disabled fields are dimmed and can't be focused. An error turns the border red and says how to fix the value.
Types and mobile keyboards
On a phone, the field’s type decides which keyboard appears. A missing or wrong type is a real, reportable bug: imagine typing an email on a keyboard with no @ key, or a postcode on a full letter keyboard.
⌨️ One field, many keyboards
On a phone, the input type decides which keyboard opens. Pick a field type and see what the user gets.
@gmail.com|@icloud.com
qwertyuiop
asdfghjkl
zxcvbnm
123space@.return
Web (HTML)
type="email" autocomplete="email"
iOS keyboard type
.emailAddress, autocapitalization off
Android inputType
textEmailAddress
What to check
The @ and . keys are visible, the first letter is NOT capitalized, and autocorrect does not "fix" the address.
Pick a strategy, then type an address slowly, e.g. "anna@test.com". Try leaving the field half-done, too.
Sign in to FreshCart
We'll email you a one-time code.
0
times an error popped up while typing
—
no error shown
On blur
No error until you leave the field. After that, the field re-checks as you type, so the error disappears the moment the value is fixed. This "late to complain, quick to forgive" approach is the usual recommendation.
Autofill and autocomplete
Phones and browsers can fill in names, addresses, passwords and one-time codes for the user. It only works if each field tells the system what it contains.
Dev note: Autofill values per platform
Field
Web autocomplete
iOS textContentType
Android autofillHints
Full name
name
.name
personName
Email
email
.emailAddress
emailAddress
Phone
tel
.telephoneNumber
phone
Street address
street-address
.fullStreetAddress
postalAddress
Postcode
postal-code
.postalCode
postalCode
New password
new-password
.newPassword
newPassword
SMS code
one-time-code
.oneTimeCode
smsOTPCode
When testing autofill, check that values land in the right fields (no surname in the city field), that autofilled values pass validation (autofill sometimes adds a trailing space), and that floating labels don’t overlap the filled text.
Check this part
The quantity field shows a number pad. Do you still need to test letters?
The keyboard type is only a hint. Validation must still handle unexpected characters.
What is the difference between a disabled and a read-only field?
Both can't be changed, but read-only text stays selectable, copyable and readable.
You fix the value in a field with an error. When should the error message go away?
Whatever validation timing the team chose, the error must disappear once fixed, and the message must say what to do.
Keyboard types, the states a field moves through, when errors should appear, and autofill that only works when fields say what they hold.
Part Not started
When to use it
A text field is the right choice when:
The answer is truly open: names, addresses, messages, search terms.
There are too many possible values to list (every email address in the world).
Users know the answer and typing is faster than scrolling (a postcode, a promo code).
Good and bad uses
A visible label above every field
Full name
Anna Kovač
Email
anna.kov
Phone
+385 91 234 5678
The label stays while you type, so you always know what the field is for.
Testers feed fields the inputs developers forget. Pick a test input (it is pasted into the field) or type your own, and see how a well-built field handles it.
Checkout details
Preview on next screen
Nothing valid to show yet
Typed / pasted
(nothing)
Length
0 characters
Result
Waiting for input…
Why testers try this
Pick a test input above. Each one targets a different kind of bug.
Find the bug
The plant shop sign-up below has six bugs. Test it like a pro:
Type valid data first, then invalid data.
Leave fields half-done and come back to fix them.
Use emoji, spaces and international formats.
Watch the keyboard, the profile preview and the network log.
🐞 Bug hunt: Bloom sign-up
This demo has 6 hidden bugs. Explore it like a tester, then check your findings.
Found0/6
9:41
Create account
Profile preview
Hi, there!
Display name0/30
Email
Phone
Year of birth
Password
Tip: the keyboard shows which type each field opens.
Network log
Create an account to see the request body…
1
Hint: Leave the email field with a typo, then go back and fix it.
Email error does not clear after fixing the value
The error is checked when you leave the field, but only cleared when you press Create account. After fixing anna@test to anna@test.com the red message still says the email is invalid. Expected: the error disappears as soon as the value is valid.
2
Hint: Keyboards and autofill often add a space after the last word.
A trailing space makes a valid email invalid
anna@test.com (with a space at the end) is rejected, even on submit. The app validates the raw value without trimming it. Expected: leading and trailing spaces are removed before validating and saving.
3
Hint: Put emoji in the display name and watch the counter.
Character counter counts emoji wrongly
The counter uses the string length in code units: one 🌸 counts as 2, and 👩💻 counts as 5, so users hit the 30-character limit long before 30 visible characters. Expected: the counter counts characters the way people see them.
4
Hint: Type the phone number in the format shown in the placeholder.
Phone number is cut off silently
The field stops accepting input after 10 characters, so +385 91 234 5678 becomes +385 91 23 with no message, and the cut number is sent to the server (see the network log). Expected: international numbers fit, or a clear message explains the limit.
5
Hint: Look at the keyboard for Year of birth, then try typing letters.
Year of birth accepts letters and opens the wrong keyboard
The field opens the full letter keyboard and accepts values like 19ab or 3000; the account is created with that value. Expected: a number pad (inputmode="numeric") and validation that only allows realistic 4-digit years.
6
Hint: Type a display name like <b>Anna</b> and watch the profile preview.
Display name is rendered as HTML in the profile card (XSS)
The preview shows Anna in bold instead of the literal text <b>Anna</b>. With <img src=x onerror=alert(1)> a script runs (simulated here). Expected: user input is always shown as plain text. Severity: critical.
Check this part
A valid email with a trailing space is rejected. What is the most likely cause?
Autofill and copy-paste often add a space. The app should trim leading and trailing spaces before validating and saving.
You type <b>Anna</b> as your name and the confirmation screen shows "Anna" in bold. How serious is this?
If formatting tags take effect, scripts probably can too. Report it as a security issue right away.
Which inputs belong on your personal list of nasty test data?
Reuse a list of negative tests and edge cases on every project, including boundary values.
Untrimmed spaces, stale errors, silent truncation, emoji counts, wrong keyboards, rejected valid names, input rendered as HTML and lost text.
Part Not started
How to test it
Start without any tools. Find a screen that uses this component and use it the way a real user would: slowly, then fast, then in ways nobody planned for. Tick off the checklist as you go. Most of it needs only your eyes and your fingers.
Then try the example test cases. Some of them need a little setup:
A slow or missing connection: switch on airplane mode, or slow the network down. See Network conditions.
New to this? Do the checklist first and skip any test case whose setup you don’t know yet.
Checklist
Text field test checklist
0 of 14 checked
Example test cases
TC-TXT-001Valid email is acceptedpositivehigh
Steps
Open the Sign-up screen
Enter "anna@test.com" in Email
Fill other fields with valid data
Tap "Create account"
Expected result
No error is shown and the account is created with email "anna@test.com".
TC-TXT-002Email with surrounding spaces is trimmededgehigh
Steps
Enter " anna@test.com " in Email (two spaces before and after)
Move to the next field
Tap "Create account"
Expected result
No error is shown. The saved / sent value is "anna@test.com" without spaces.
TC-TXT-003Error disappears once the value is fixednegativemedium
Steps
Enter "anna@test" in Email
Move to the next field
Go back and change the value to "anna@test.com"
Expected result
An error appears after step 2 and disappears as soon as the value becomes valid in step 3, without submitting.
TC-TXT-004Name accepts apostrophes and local letterspositivehigh
Steps
Enter "Seán O'Brien" in Full name and save
Repeat with "Đurđica Šćepanović" and "Јована Петровић"
Reopen the profile
Expected result
All names are accepted and displayed exactly as entered on every screen and in emails.
All entered values (except possibly the password, if the team decided so) are still in the fields.
Tip: click a test case to expand it.
Check this part
A user rotates the phone while filling in a long delivery note. What should happen to the text?
Lost data after rotation, app switches or a failed submit is a high-severity bug.
The name O'Brien is refused by a sign-up form. What is this?
Real names contain apostrophes, accents and short surnames. Rejecting them is a high-severity bug.
A checklist and example test cases for labels, keyboards, trimming, limits, international input, errors, paste and kept text.
Part Not started
Accessibility
Text fields are where many users with disabilities get stuck. Check these:
A real label. Every field needs a label connected to it in code. A placeholder doesn’t count. Test it: tapping the label on the web should focus the field.
Dev note
<label for> on the web, accessibilityLabel on iOS, labelFor or a Material label on Android.
Autocomplete attributes help users with motor or memory difficulties fill forms without typing. On the web that’s a WCAG requirement for fields about the user, too (1.3.5 Identify Input Purpose, Level AA).
Keyboard type, auto-capitalization, autocorrect and the autofill content type are set per field. Check all four.
Dev note
The autofill content type is textContentType.
Clear button (“x”) and secure entry (dots) are built in.
The keyboard can cover the field: scroll the form and check the focused field is visible.
Test Dynamic Type, dark mode and the Passwords autofill bar.
Dev note
Native component: EditText; with Material Design, TextInputLayout (filled or outlined) or TextField in Jetpack Compose.
Test the keyboard with Gboard and Samsung Keyboard, because they behave differently.
Dev note
The inputType controls the keyboard.
Floating labels: check they don’t overlap autofilled text or the prefix/suffix.
Check what happens after rotation and after the app is killed in the background: the text should survive.
Test with font scale, display size and TalkBack.
Dev note
HTML <input> with a type (email, tel, password, number, url, search) or <textarea>.
Number fields have quirks on the web: they accept the letter “e”, and in Chromium browsers the mouse wheel changes a focused value (see Stepper). Try both.
Dev note
That’s type="number". Many teams use inputmode="numeric" instead; know which one your app uses.
Use DevTools to check that the field has a label, says what it holds for autofill, and exposes its error to screen readers.
Dev note
The label, autocomplete, aria-invalid and aria-describedby attributes.
Test browser autofill in Chrome, Safari and Firefox, plus password managers.
Test on a phone browser too: the right keyboard has to appear there as well.
Dev note
It depends on type and inputmode.
Check this part
A field shows an error with only a red border. What is missing?
Errors must not rely on color alone. There must be text that a screen reader can announce too.
On the web, how can you quickly check that a field has a label connected to it?
A label connected in code focuses its field when you tap it. A placeholder doesn't count as a label.
A real connected label, announced errors that aren't color only, contrast, big text and autocomplete; then iOS, Android and web specifics.
Key takeaways
A text field accepts anything, so test far beyond the happy path: empty, spaces, long, emoji, accented letters, apostrophes, HTML and pasted text.
Every field needs a visible label. A placeholder is an example, not a label.
The input type decides the mobile keyboard and autofill, but it’s not validation.
Errors should appear at a sensible time, explain how to fix the value, and disappear once it’s fixed.
The classic bugs: untrimmed spaces, stale errors, silent truncation, wrong counts with emoji, wrong keyboards, valid names rejected, and input rendered as HTML.
Finished this page?Nice work, this page is complete!
Mark it as done to track your progress. It's saved in this browser, no account needed.