Inputs

Text field, text area, and dropdown. Every field has a visible label, says required in words, ties its hint and error to the control, and tells people exactly what to fix.

Try it

Leave something out and press Check. Each error says what to do, sits by its field, and focus moves to the first one.

We only use it to reply to you.

A few lines is plenty.

States

Use the email on your invoice.

Error: Enter a phone number, like 555 201 4477.

You can copy it, not change it.

Plans change at renewal.

Code

Plain HTML for any site, or React. Both use the same styles, so the inputs looks the same wherever it lands.

ReadyAny website, Shopify, WordPress, Square, plain hosting

<link rel="stylesheet" href="tokens.css">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="forms.css">

<!-- Text field: a visible label, required in words, a hint, and autocomplete. -->
<div class="prism-field">
  <label class="prism-label" for="email">Email <span class="prism-label__note">(required)</span></label>
  <p class="prism-hint" id="email-hint">We only use it to send your receipt.</p>
  <input class="prism-input" id="email" name="email" type="email" autocomplete="email" required aria-describedby="email-hint">
</div>

<!-- With an error: aria-invalid, and the message tied to the field. Say what to do. -->
<div class="prism-field">
  <label class="prism-label" for="phone">Phone</label>
  <p class="prism-error" id="phone-error"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5.5M12 16.5v.5" stroke-linecap="round"/></svg><span><span class="prism-visually-hidden">Error: </span>Enter a phone number, like 555 201 4477.</span></p>
  <input class="prism-input" id="phone" name="phone" type="tel" autocomplete="tel" aria-invalid="true" aria-describedby="phone-error">
</div>

<!-- Text area. -->
<div class="prism-field">
  <label class="prism-label" for="about">About your project</label>
  <textarea class="prism-input" id="about" name="about" rows="4"></textarea>
</div>

<!-- Dropdown: the native select, so phones show their own picker. -->
<div class="prism-field">
  <label class="prism-label" for="budget">Budget</label>
  <select class="prism-input" id="budget" name="budget">
    <option value="">Choose one</option>
    <option>Under $5,000</option>
    <option>$5,000 to $15,000</option>
    <option>Over $15,000</option>
  </select>
</div>

<!-- Read only: can be read and copied. Disabled: not in use right now. -->
<input class="prism-input" value="ORDER-20481" readonly aria-label="Order number">

Accessibility