domestic-ui GitHub

Form controls

Native form controls as styled by the domestic-ui base layer, with copyable markup.

Where form controls are used Form controls are the inputs of a form in the content area: text fields, a select, and checkboxes in a fieldset, each under its label.

Live example

Text-like inputs

<div class="grid" style="--grid-min: 14rem">
  <div>
    <label for="c-name">Name</label>
    <input id="c-name" name="name" type="text" autocomplete="name">
  </div>
  <div>
    <label for="c-email">Email</label>
    <input id="c-email" name="email" type="email" autocomplete="email">
  </div>
  <div>
    <label for="c-password">Password</label>
    <input id="c-password" name="password" type="password" autocomplete="new-password">
  </div>
  <div>
    <label for="c-search">Search</label>
    <input id="c-search" name="q" type="search">
  </div>
  <div>
    <label for="c-url">Website</label>
    <input id="c-url" name="url" type="url" placeholder="https://example.com">
  </div>
  <div>
    <label for="c-tel">Phone</label>
    <input id="c-tel" name="tel" type="tel" autocomplete="tel">
  </div>
  <div>
    <label for="c-number">Guests</label>
    <input id="c-number" name="guests" type="number" min="1" max="12" value="2">
  </div>
  <div>
    <label for="c-date">Date</label>
    <input id="c-date" name="date" type="date">
  </div>
  <div>
    <label for="c-time">Time</label>
    <input id="c-time" name="time" type="time">
  </div>
</div>

Textarea and select

<div class="grid" style="--grid-min: 14rem">
  <div>
    <label for="c-notes">Notes</label>
    <textarea id="c-notes" name="notes" rows="3"></textarea>
  </div>
  <div>
    <label for="c-plan">Plan</label>
    <select id="c-plan" name="plan">
      <option value="free">Free</option>
      <option value="team" selected>Team</option>
    </select>
  </div>
</div>

Checkboxes and radios in a fieldset

<div class="grid" style="--grid-min: 14rem">
  <fieldset>
    <legend>Notify me by</legend>
    <label><input type="checkbox" name="notify-email" checked> Email</label>
    <label><input type="checkbox" name="notify-sms"> Text message</label>
  </fieldset>
  <fieldset>
    <legend>Delivery</legend>
    <label><input type="radio" name="delivery" value="standard" checked> Standard</label>
    <label><input type="radio" name="delivery" value="express"> Express</label>
  </fieldset>
</div>

Range and file

<div class="grid" style="--grid-min: 14rem">
  <div>
    <label for="c-volume">Volume</label>
    <input id="c-volume" name="volume" type="range" min="0" max="100" value="40">
  </div>
  <div>
    <label for="c-file">Attachment</label>
    <input id="c-file" name="file" type="file">
  </div>
</div>

Attributes

No API; native elements

Accessibility

Specifications

See also

How other systems do it

For comparison only; these are not the standard this system follows.

Search