mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
Enhance Checkbox to use bind:group (#947)
* Enhance Checkbox to use bind:group * Use custom logic * Move multiple checkboxes above skeleton * Incorprate PR feedback * Any instead of string
This commit is contained in:
parent
8443b2d7c1
commit
f0cf4e7ba5
7 changed files with 58 additions and 7 deletions
15
docs/src/pages/framed/Checkbox/MultipleCheckboxes.svelte
Normal file
15
docs/src/pages/framed/Checkbox/MultipleCheckboxes.svelte
Normal file
|
@ -0,0 +1,15 @@
|
|||
<script>
|
||||
import { Checkbox } from "carbon-components-svelte";
|
||||
|
||||
let options = ["Apple", "Banana", "Coconut"];
|
||||
let selection = options.slice(0, 2);
|
||||
</script>
|
||||
|
||||
{#each options as option}
|
||||
<Checkbox bind:group="{selection}" labelText="{option}" value="{option}" />
|
||||
{/each}
|
||||
|
||||
<div style="margin: var(--cds-layout-01) 0">
|
||||
Selected options:
|
||||
<strong>{selection.join(", ")}</strong>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue