Text Fields

Explore iOS Text Field Plain and Rounded styles interactively. Change properties in the control panel to see them reflected on the iPhone screen instantly.

9:41
●●●● WiFi 🔋
Text Fields
Account Information
Name
Email
Password
Keyboard Type
Input
ABC
⚠️ HIG Violation: Improper text field
📚 HIG Guidelines — Try It Yourself
✓ Do — Good Example
✗ Don't — Bad Example

✓ Do This

  • Use clear, descriptive placeholder text
  • Use the appropriate keyboard type for the input
  • Show a clear button for easily erasable fields
  • Use SecureField for passwords and sensitive data
  • Validate input and provide helpful error messages
  • Group related fields in a Form or List

✗ Don't Do This

  • Don't use placeholder text as a substitute for labels
  • Don't use the default keyboard for email or number inputs
  • Don't show a plain TextField for password entry
  • Don't make text fields too narrow to display content
  • Don't require users to type information that can be auto-filled

👆 See the bad pattern in the iPhone preview above

Default
Email
Number
Show Clear Button
Show Secure Field
SwiftUI Code
Form { TextField("Name", text: $name) TextField("Email", text: $email) .keyboardType(.emailAddress) SecureField("Password", text: $password) }