Ensure checkbox always has a size class

This commit is contained in:
Andrew Kingston 2021-08-11 15:21:35 +01:00
parent 50247bd066
commit 0c5a34dacb
1 changed files with 4 additions and 2 deletions

View File

@ -8,16 +8,18 @@
export let id = null export let id = null
export let text = null export let text = null
export let disabled = false export let disabled = false
export let size = null export let size
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = event => { const onChange = event => {
dispatch("change", event.target.checked) dispatch("change", event.target.checked)
} }
$: sizeClass = `spectrum-Checkbox--size${size || "M"}`
</script> </script>
<label <label
class="spectrum-Checkbox spectrum-Checkbox--size{size} spectrum-Checkbox--emphasized" class="spectrum-Checkbox spectrum-Checkbox--emphasized {sizeClass}"
class:is-invalid={!!error} class:is-invalid={!!error}
> >
<input <input