Form Basics
Ready-to-copy variants of molique's basic text fields - floating labels, native validation, sizes, and a self-expanding textarea.
Floating Labels
The label sits inside the field and smoothly floats upward when clicked or once typing starts.
<div class="form-floating">
<!-- The placeholder=" " attribute is required for the CSS magic to work! -->
<input type="text" class="input" id="name" placeholder=" ">
<label for="name">Full name</label>
</div>
Native Validation (Zero JS)
Uses the :user-invalid pseudo-class - the error
message only appears once the user leaves an incorrectly
filled-in field.
<div class="form-floating">
<input type="email" class="input" id="email" placeholder=" " required>
<label for="email">Work email</label>
<!-- Error message (CSS shows it automatically via :user-invalid) -->
<div class="feedback-invalid">Invalid email address.</div>
</div>
Size Variants (sm / lg)
Every element with the .input class - input,
select, and textarea - supports the same size modifiers.
<input type="text" class="input input-sm" placeholder="Compact">
<input type="text" class="input" placeholder="Default">
<input type="text" class="input input-lg" placeholder="Large">
<select class="input input-sm">...</select>
One-Line Textarea (Auto-Expand)
The field occupies the height of a single line, then expands to several rows once clicked or filled in - no JavaScript required.
<textarea
class="input textarea-expandable"
rows="1"
placeholder="Click to expand…"
style="--textarea-rows-expanded: 8;"
></textarea>