Validation states
The same classes and attributes on every kind of control: default with help, valid, invalid, warning and disabled, on inputs, selects, input groups and checkboxes. Each state pairs its color with an icon and words, so it reads the same without color.
Default with help
Most teams offer 2 or 4 hours.
Valid
10% off your first order
Invalid
A ZIP code has five digits.
Warning, still allowed
Over 5 kg ships as freight.
Invalid select
Pick the kind of visit.
Invalid input group
Price has to be above zero.
Invalid checkbox
Accept the terms to open an account.
Disabled
Set once, when the account was created.
Show code
<label class="form-label" for="zip">ZIP code</label> <input class="form-control is-invalid" id="zip" aria-invalid="true" aria-describedby="zip-error"> <p class="val-error" id="zip-error">A ZIP code has five digits.</p> <!-- A warning leaves the field usable --> <div class="input-group val-is-warning">…</div> <p class="val-warn" id="weight-note"><i class="bi bi-exclamation-triangle"></i>Over 5 kg ships as freight.</p>