Files
milsim-site-v4/ui/src/components/form/FormCheckbox.vue
2025-08-21 19:33:43 -04:00

45 lines
1019 B
Vue

<script setup>
import {
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from '@/components/ui/form'
import Input from '../ui/input/Input.vue';
import Checkbox from '../ui/checkbox/Checkbox.vue';
const props = defineProps({
name: {
type: String,
required: true
},
description: {
type: String,
default: ''
},
label: {
type: String,
default: ''
},
readOnly: {
type: Boolean,
default: false
}
});
</script>
<template>
<FormField :name="props.name" v-slot="{ value, handleChange }">
<FormItem>
<FormLabel>{{ props.label }}</FormLabel>
<FormDescription>{{ props.description }}</FormDescription>
<FormControl>
<Checkbox :checked="value ?? false" @update:checked="handleChange" :disabled="props.readOnly" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</template>