Forms
Label above, input full width, validation below. FluentValidation on the server, no
client-side validation. koala-inline-validation-for
wires per-field validation on blur via Alpine-AJAX.
Canonical
One <koala-field> tag replaces a four-line
<label> + <input> +
<span asp-validation-for> quadruple. Single column on every viewport.
Variants
5 variantskoala-switch.koala-radio-yes-no.States
4 statesProps
7 attributes| Attribute | Values | Notes |
|---|---|---|
| for | Razor model expression | Required, binds to the input model property. |
| label | string | Above the input. Auto-required suffix when the validator has NotEmpty(). |
| type | text, email, tel, url, number, password | HTML input type. Defaults to text. |
| koala-input-prefix | Email, Phone | Leading icon inside the input. |
| koala-inline-validation-for | Razor model expression | Wires per-field validation on blur via Alpine-AJAX. |
| koala-invalid-for | Razor model expression | Adds the invalid border to a custom picker (button, div, etc.). |
| novalidate | — | Always on the form. FluentValidation is the sole validator. |
Do & don't
Working example
Form actions
Bottom-of-form action button row. Stacks vertically on mobile, switches to horizontal on
sm: and above. Replaces the
flex flex-col sm:flex-row gap-3 wrapper that opens every form footer.
Form errors
Top-of-form danger banner that renders the model-level ModelState[string.Empty]
errors. Renders nothing when the form is valid, so the spacing doesn't shift between states.
That email address is already in use.
Sign-in didn't recognise the password. Try again or reset it.
Mounted via <koala-form-errors />; the danger block above is a static
visualisation because the design page has no failing ModelState to seed real errors from.