Examples
Documentation
Switch props
Parameters accepted by
{#include components/forms/switch ... /}. Model mode: pass
sw=<Switch> built in Java instead — the Java tab on each example shows the
builder.
| Name | Type | Description |
|---|---|---|
* id
|
String |
Wrapper id; inner input gets {id}-field.
|
label
|
String | Visible label next to the toggle. |
checked / disabled
|
boolean | Standard HTML form attrs. |
reversed
|
boolean |
Adds pf-m-reverse — label before toggle.
|
Usage
Switch vs. Checkbox. Switch is for immediate-effect settings (toggle wifi, enable feature). Checkbox is for batched form decisions (terms accepted, options selected before submit).
HTMX pairing. Pair with hx-post on change so the server commits the
setting immediately and returns a partial.