This commit is contained in:
Jan Prochazka
2021-03-25 13:50:23 +01:00
parent bc9e8a2ea6
commit 2afa7a5f58
2 changed files with 6 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
import CheckboxField from './CheckboxField.svelte';
export let name;
export let defaultValue;
const { values, setFieldValue } = getFormContext();
function handleChange(e) {
@@ -10,4 +11,4 @@
}
</script>
<CheckboxField {...$$restProps} checked={$values[name]} on:change={handleChange} />
<CheckboxField {...$$restProps} checked={$values[name] ?? defaultValue} on:change={handleChange} />