Docs / Components / Inputs
Inputs
Accessible CSS text inputs with labels, hints, required markers and error states, plus inputs with icons, prefixes and suffixes. Works with plain HTML forms and any framework.
Inputs
Fields use the same raised surface as secondary buttons, so they look like part of the same family. On focus they get a brand-colour border and ring. Wrap each one in ace-field to stack the label, control and hint or error.
We'll send the booking confirmation here.
Use the format 01-123-AB.
<div class="ace-field">
<label class="ace-label" for="email">Email <span class="ace-required">*</span></label>
<input id="email" type="email" class="ace-input" placeholder="you@example.com"
aria-describedby="email-hint" required>
<p class="ace-hint" id="email-hint">We'll send the booking confirmation here.</p>
</div>
<!-- Error: aria-invalid="true" (or class="is-invalid") + .ace-error -->
<input id="plate" class="ace-input" aria-invalid="true" aria-describedby="plate-err">
<p class="ace-error" id="plate-err">Use the format 01-123-AB.</p>
<!-- 40px to sit next to a default button: ace-input--lg -->Do
- Always give a field a visible
<label for>. A placeholder isn't a label. - Write the error message so it says how to fix the problem.
- Set the right
type,inputmodeandautocompleteso phones show the right keyboard.
Don't
- Shrink the font below 16px on mobile, because iOS will zoom in. The kit already handles this.
- Show an error before the user has left the field or submitted the form.
Input with icon, prefix or suffix
Put a plain borderless <input> inside ace-input-group. The outer shell draws the border and the focus ring.
<label class="ace-input-group"> <svg …/> <input type="search" placeholder="Search cars, customers…" aria-label="Search"> </label> <label class="ace-input-group"> <span class="ace-addon">€</span> <input type="number" aria-label="Price"> <span class="ace-addon">/ day</span> </label> <!-- Error: add .is-invalid to the group -->
Use it
One stylesheet from the CDN, pinned to v1.3.0:
<link rel="stylesheet" href="https://acecss.dev/v1.3.0/ace.min.css"
integrity="sha384-zHAwOqjifsc0D+iUvzD1a4W0R2g0BOK9AqQJZGakUEp/Tm5IUcP07R9xkY0q/stj" crossorigin="anonymous">Or from npm:
npm i @acecss/core import '@acecss/core'
Bundlers, Tailwind, every script in one file and self-hosting: Install.