bind:checked for Checkboxes
Bind a boolean variable to a checkbox input's checked state.
Checkbox Binding
Use bind:checked to sync a boolean with a checkbox input.
<input type="checkbox" bind:checked={agreed} />Reading the State
The bound variable is true when checked, false when not.
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