Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Input with Helper Text for React

An Email field with the placeholder you@example.com and a line under it that says the address will not be shared.

An Email label, the placeholder you@example.com, and a line under the field: We'll never share your email with anyone else. The note stays while someone types.

Use it for a privacy note or a format hint that should remain visible. Put a rule they must read first above the field. Errors replace this line via Field. In React, Base UI does not write the helper text.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Input anatomy: input, placeholder, value, caret

Usage

<Field className="w-full max-w-sm">
  <FieldLabel htmlFor="helper-email">Email</FieldLabel>
  <Input
    className="bg-background"
    id="helper-email"
    placeholder="you@example.com"
    type="email"
  />
  <FieldDescription>
    We’ll never share your email with anyone else.
  </FieldDescription>
</Field>

FAQ

What is the line under the field?

A FieldDescription after the input, in smaller, muted text. Placed after the input, it reads as a note on what was typed rather than an instruction.

Why type email?

The browser checks the address format when the form is submitted, and mobile keyboards show the @ key. The placeholder you@example.com shows the expected shape.

When should the text go above the field instead?

When it changes what people will enter, such as what a username is for. The Description example puts it between the label and the input.

What about errors?

Keep the helper text for guidance and show problems in FieldError when the field is invalid, as the Error State example does.

Do screen readers read the helper text?

They reach it after the input in reading order. To have it read when the input gets focus, give it an id and set aria-describedby on the input to it.

How is Email tied to the field?

Clicking the label focuses the field, and screen readers announce it with the field. FieldLabel sets htmlFor to helper-email, the input's id.

API Reference

Field

Sets htmlFor="helper-email". The rest is on the Field page.

Input

Sets id="helper-email", placeholder="you@example.com" and type="email". The rest is on the Input page.