1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-15 17:44:12 +00:00
bramw_baserow/web-frontend/modules/core/components/Checkbox.vue
2023-11-02 05:48:47 +00:00

44 lines
890 B
Vue

<template>
<div class="checkbox" :class="classNames" @click="toggle(value)">
<i v-if="value === true" class="checkbox__checked-icon iconoir-check"></i>
<label class="checkbox__label"><slot></slot></label>
</div>
</template>
<script>
export default {
name: 'Checkbox',
props: {
value: {
type: Boolean,
required: false,
default: false,
},
disabled: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
classNames() {
return {
'checkbox--has-content': Object.prototype.hasOwnProperty.call(
this.$slots,
'default'
),
'checkbox--disabled': this.disabled,
active: this.value === true,
}
},
},
methods: {
toggle(value) {
if (this.disabled) {
return
}
this.$emit('input', !value)
},
},
}
</script>