Input

Text-like inputs: text, email, password, search, tel, url, number, and the date and time family, which get an icon on the trailing edge.

ClassDoes what
inputFull-width field with the shared control surface
input-errorError color, for when aria-invalid is not available

Basic

<input type="text" class="input" placeholder="Text" />
<input type="email" class="input" placeholder="you@example.com" />
<input type="password" class="input" value="hunter2" />

Date and time

<input type="date" class="input" />
<input type="time" class="input" />
<input type="month" class="input" />

Invalid and disabled

<input type="text" class="input" aria-invalid="true" value="Invalid" />
<input type="text" class="input" value="Disabled" disabled />

Classless: every <code>input</code> gets this styling except checkbox, radio, range, file, color, and the button types, which are styled as buttons.

Composition

Common ways to put this together with other components. The general rules are on Composition.

Inline sign-up

A heading, a sentence, one field and a button.

Same markup in both builds
<form class="prose">
  <h2>Newsletter</h2>
  <p>A short note when there is something new.</p>
  <div class="field-row">
    <label class="label" style="flex: 1">
      <p>Email</p>
      <input class="input" type="email" placeholder="you@example.com" autocomplete="email" />
    </label>
    <button class="btn btn-secondary">Subscribe</button>
  </div>
</form>

Search above results

A search field and a count, then the results.

Same markup in both builds
<label class="label">
  <p>Search</p>
  <input class="input" type="search" placeholder="Title or topic" />
</label>
<p class="text-secondary"><small>12 results</small></p>