Forms
Form adorn
Icons, shortcuts and buttons inside inputs.
<label class="form-adorn">
<i class="mi mi-search adorn-start"></i>
<input class="form-control" placeholder="Search…">
<kbd class="adorn-end">Ctrl K</kbd>
</label>
Show password
A button inside the field (a clickable adornment). The tiny script just flips the input type.
<div class="form-adorn">
<input class="form-control" type="password">
<button type="button" class="btn btn-ghost btn-icon btn-sm adorn-end" aria-label="Show password">
<i class="mi mi-eye"></i>
</button>
</div>
Units and prefixes
Short text inside the field. For a unit or prefix in its own box, or with a dropdown or button attached, use an input group.
$
kg
moey.shop/
<div class="grid grid-cols-1 gap-3 max-w-sm">
<div class="form-adorn">
<span class="adorn-start text-sm">$</span>
<input class="form-control" type="number" value="129.00" aria-label="Price">
</div>
<div class="form-adorn">
<input class="form-control" type="number" value="1.2" aria-label="Weight">
<span class="adorn-end text-sm">kg</span>
</div>
<div class="form-adorn">
<span class="adorn-start text-sm">moey.shop/</span>
<input class="form-control ps-24" value="spring-sale" aria-label="Page URL">
</div>
</div>
Clear button
<div class="form-adorn max-w-sm">
<i class="mi mi-search adorn-start"></i>
<input class="form-control form-filled" type="search" value="linen tote" aria-label="Search">
<button type="button" class="btn-close btn-close-sm adorn-end" aria-label="Clear search" onclick="const i=this.previousElementSibling; i.value=''; i.focus()"></button>
</div>