<script setup>
import { useErrorMessage } from "./useErrorMessage";
import { computed, ref } from "vue";
const props = defineProps({
  context: Object
});
const value = computed({
  get: () => props.context.value,
  set: (val) => props.context.node.input(val)
});
const error = ref(false);
const errorMessage = ref("");
useErrorMessage(props.context.node, error, errorMessage);
</script>

<template>
    <l-checkbox v-model="value" :error="error" :error-message="errorMessage" :disable="context.disabled"
        v-bind="context.attrs" :label="context.label">
        <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
            <slot :name="name" v-bind="props ?? {}"></slot>
        </template>
    </l-checkbox>
</template>
