Skip to main content
  1. Docs
  2. Components
  3. Forms

Text field

A labelled text input: the default form row. A label always; a placeholder is only an example.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<input>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

When to use

Use it for
  • Any short text: a name, an email, an ID, a URL.
  • A form row with its label, description and error in one.
  • Values with a unit or a suffix: ₹, .qeet.in.
Not for

02

Anatomy

  1. 1field-label<label>Names the input. Always shown; "(optional)" when it is.
  2. 2input<div>The box: a filled surface with a bottom line.
  3. 3input-icon<svg>A leading icon, 16px, decorative.
  4. 4field-description<p>Help under the box; the error takes its place.

03

Do and don't

A label, always
DoThe label names it; the placeholder is an example.
Don'tA placeholder for a label: it's gone once you type.
Mark the optional
Dooptional adds "(optional)"; the rest are needed.
Don'tAsterisks on the required ones.
Errors say how to fix it
DoWhat to do, with an example.
Don'tWhat went wrong, and no more.

04

Content

  • Labels are nouns, in sentence case: "Work email".
  • Placeholders are examples, starting "e.g."; never instructions.
  • Errors say how to fix it: "Enter an email like priya@acme.in."
Next — Text fieldAPI