Simple Form
A form wrapper that automatically styles all child form elements without requiring explicit classes.
How It Works
The
.form
class acts as a context selector that enables automatic styling for labels, inputs, textareas, selects, checkboxes, and more. Just wrap your form elements and they'll be styled consistently.
Basic Form
Various Input Types
All standard HTML input types are automatically styled.
Input Types
Checkboxes & Radios
Checkboxes and radio buttons are also automatically styled.
Checkboxes & Radios
With LiveView Forms
For LiveView forms with changesets, add
class="form"
to the standard
<.form>
component.
# For LiveView forms, add class="form" directly:
<.form for={@form} class="form grid gap-6" phx-submit="save">
<div class="grid gap-2">
<label for={@form[:name].id}>Name</label>
<input type="text" name={@form[:name].name} value={@form[:name].value} />
</div>
<.button type="submit">Save</.button>
</.form>