You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/binding-input-group-each-4/main.svelte

33 lines
581 B

<script>
const options = [1, 2, 3];
export let selected_array_1 = [[1], [2]];
export let selected_array_2 = [[], [3]];
</script>
{#each selected_array_1 as selected}
{#each options as value}
<label>
<input
type='checkbox'
bind:group={selected}
value={value}
/>
{value}
</label>
{/each}
<p>{selected.join(', ')}</p>
{/each}
{#each selected_array_2 as selected}
{#each options as value}
<label>
<input
type='checkbox'
bind:group={selected}
value={value}
/>
{value}
</label>
{/each}
<p>{selected.join(', ')}</p>
{/each}