39 lines
805 B
Vue
39 lines
805 B
Vue
<template>
|
|
<input
|
|
:id="id"
|
|
class="mr-2 rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
|
|
type="checkbox"
|
|
:checked="modelValue === 'true' || modelValue === true"
|
|
:class="$attrs.class"
|
|
@change="$emit('change', $event)"
|
|
@input="$emit('update:modelValue', $event.target.checked)"
|
|
>
|
|
<label
|
|
v-if="label"
|
|
class="text-sm font-medium text-gray-700"
|
|
:for="id"
|
|
v-text="label"
|
|
/>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
modelValue: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
label: {
|
|
type: String,
|
|
default: null,
|
|
required: false,
|
|
},
|
|
id: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
},
|
|
emits: ['update:modelValue', 'change'],
|
|
}
|
|
</script>
|