bind:group for Radio and Checkbox Groups
Synchronize a group of related inputs to a single variable.
Radio Groups
For mutually exclusive options, use multiple radios with the same bind:group variable.
<input type="radio" bind:group={size} value="sm" /> S
<input type="radio" bind:group={size} value="md" /> M
<input type="radio" bind:group={size} value="lg" /> LHow It Works
The bound variable equals the value of the selected radio.
All lessons in this course
- bind:value for Text Inputs
- bind:checked for Checkboxes
- bind:group for Radio and Checkbox Groups
- bind:this for DOM Element References