Form controls
Native form controls as styled by the domestic-ui base layer, with copyable markup.
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
- Styled by the base layer; see Base elements.
Specifications
See also
- Atoms
- Component API convention
- Accessibility baseline
- Source:
css/base/forms.css(base layer; no CSS file of its own),examples/atoms/controls.html
How other systems do it
For comparison only; these are not the standard this system follows.
- Apple Human Interface Guidelines: Text fields
- Apple Human Interface Guidelines: Toggles
- Apple Human Interface Guidelines: Pop-up buttons
- Apple Human Interface Guidelines: Sliders
- Material Design 3: Text fields
- Material Design 3: Checkbox
- Material Design 3: Radio button
- Material Design 3: Switch
- Material Design 3: Menus
- Material Design 3: Sliders
- Vercel Geist: Input
- Vercel Geist: Checkbox
- Vercel Geist: Radio
- Vercel Geist: Switch
- Vercel Geist: Select
- Vercel Geist: Slider