mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
refactor(checkbox): make classes reactive
This commit is contained in:
parent
f75e3264cc
commit
60d9258d0b
4 changed files with 29 additions and 25 deletions
|
@ -8,6 +8,8 @@
|
|||
|
||||
const { labelText, indeterminate, disabled, hideLabel, wrapperClassName } = $$props;
|
||||
const checkboxProps = { labelText, indeterminate, disabled, hideLabel, wrapperClassName };
|
||||
|
||||
let checked = true;
|
||||
</script>
|
||||
|
||||
<Layout>
|
||||
|
@ -22,8 +24,14 @@
|
|||
{:else}
|
||||
<fieldset class={cx('--fieldset')}>
|
||||
<legend class={cx('--label')}>Checkbox heading</legend>
|
||||
<Checkbox {...checkboxProps} checked id="checkbox-label-1" />
|
||||
<Checkbox {...checkboxProps} checked id="checkbox-label-2" />
|
||||
<Checkbox
|
||||
{...checkboxProps}
|
||||
id="checkbox-label-1"
|
||||
bind:checked
|
||||
on:check={({ detail }) => {
|
||||
console.log('on:check', detail);
|
||||
}} />
|
||||
<Checkbox {...checkboxProps} id="checkbox-label-2" checked />
|
||||
</fieldset>
|
||||
{/if}
|
||||
</Layout>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue