Skip to main content
InputLevel 1

Text Field

文本输入框

WebMobileDesktopDifficulty: Easy

A bordered box the user types into — the most basic input control there is, and the one whose quality varies the most.

01

Live Demo

Actually clickable

Used to send your cleanup report. Never shown publicly.

Validation waits for blur — it shouldn't turn red on every keystroke. The error message has to say how to fix it.

What you just saw:The "Email" and "Password" fields on a sign-up page, a search box, the single line that pops up the keyboard when you tap it in a notes app — all Text Fields.

02

What it actually is

The Text Field is the most fundamental input component. Good ones and bad ones differ in ways that are easy to miss: whether there is a real label ("Email" or "Enter your email address"), where the error message appears, and whether the field grows to hold multiple lines.

text fieldtext inputtextboxsingle-line inputinput boxedit field
03

Anatomy · What it's made of

  1. Label标签

    Sits above the field and says what belongs here

  2. Container输入框

    1px border, 8px radius, 44px tall

  3. Placeholder占位文字

    Never a substitute for the label

  4. Helper Text辅助说明

    Always-on text below, e.g. the password rules

  5. Error State错误态

    Red border plus red explanatory text below

04

When to Use

When it fits, and when it doesn't
Text Field usage recommendations
SituationUse it?
The user needs to enter free-form textYes
The expected input is long but its length is predictableYes
The value needs format validation (email, phone number)Yes
There are fewer than 5 optionsNo
What the user types should not be logged or displayedDepends

Password entry belongs in a dedicated Password Field with a show/hide toggle and strength feedback.

Data with a fixed format (dates, choices) should use a purpose-built control instead of making the user type it.

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Add an email field: a Label reading "Email" on top, always-on helper text "Used to receive notifications" below, format validation on blur, and on error a red border with red explanatory text underneath.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

Add a box people can type in.

Say this instead

Add an email Text Field: a Label reading "Email" on top (the placeholder must not replace the label), validation on blur, and on error a #A8342C border + red explanatory text below + aria-invalid.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.