Text Input
Lets the user enter and edit a single line of text.
01Anatomy
8 parts. Select a number or a name to see what each part does.
01 · Label
Names the field. It stays visible while the user types.
- Required
- Yes
- Recommended
- Short, above the field. A placeholder is not a label.
02 · Required indicator
Marks a mandatory field, often with an asterisk or the word “required”.
- Required
- Only in some cases
- When
- Only on mandatory fields. Some systems mark the optional ones instead.
- Recommended
- Explain the asterisk once at the top of the form, and set required in code too.
03 · Field
The box that receives the input. Border and fill change with the state.
- Required
- Yes
- Recommended
- Its width hints at the expected length: a postcode field can be short.
04 · Leading icon
Hints at the type of content, like a mail or search symbol.
- Required
- No
- When
- Avoid it when it repeats the label and adds nothing.
05 · Input text
The text the user types. When the field is empty, placeholder text can sit here.
- Required
- Yes
- Recommended
- Common pattern: a placeholder only for an example, like name@example.com. Put the format rule in the helper text: the placeholder disappears as you type.
06 · Trailing action
An action on the content: clear, show password. Or a unit or a status icon.
- Required
- No
- When
- Depends on the content.
- Recommended
- If it can be clicked, it is a real button with its own label.
07 · Helper text
Short guidance under the field: format, purpose, constraints.
- Required
- No
- When
- Useful when the rule isn’t obvious.
- Recommended
- Give the rule before the mistake, not only after.
08 · Error message
Says what went wrong and how to fix it. Often takes the place of the helper text.
- Required
- Only in some cases
- When
- Only when validation fails.
- Recommended
- Text plus an icon, never colour alone: “Enter an email like name@example.com”.
Shares its area with Helper text.
Example spacing, measured on this drawing (16 px = 1 em). A common implementation, not a rule: values change from system to system. W and H are width and height, as in Figma: Hug follows the content, Fill takes the space of the parent.
Spacing is measured on the normal view: switch back to Normal to show it.
02Structure
- Text Inputcomponent setauto layoutvertical
- Labelauto layouthorizontal
- Texttext
- Requiredtextboolean
- Fieldauto layouthorizontalfillhugpadding 12gap 8
- Leading iconinstanceboolean
- Valuetextfill
- Trailing actioninstanceboolean
- Helper texttextboolean
| Property | Type | Values |
|---|---|---|
| State | Variant | EmptyHoverFocusFilledDisabledRead-onlyError |
| Size | Variant | SmallMediumLarge |
| Required | Boolean | truefalse |
| Leading icon | Boolean + Instance swap | mailsearch… |
| Trailing action | Boolean + Instance swap | clearshow password |
| Helper text | Boolean + Text | “We only use it…” |
| Value | Text | “ada@example.com” |
Keep the Error state showing the message in the helper slot, so the layout doesn’t jump.
03States
04Variants
There is no single correct anatomy: names, variants and properties differ from one design system to another. These are common structural models distilled from established design systems and accessibility guidance.
Proven methods for designing interfaces with AI. Every two weeks, in Italian.
Subscribe