gradido/frontend/src/components/ButtonRadioGroup.vue
ogerly 9891f5bd8e Add 'frontend/' from commit 'd820caba3ffcf0e94e3740ee7a25e583176d6df0'
git-subtree-dir: frontend
git-subtree-mainline: a866d737678d48a6a32d93a12c166f882626e87d
git-subtree-split: d820caba3ffcf0e94e3740ee7a25e583176d6df0
2021-02-23 15:37:04 +01:00

48 lines
1.1 KiB
Vue

<template>
<div class="btn-group-toggle" data-toggle="buttons">
<label v-for="(option, index) in options"
:key="index"
class="btn"
:class="[{ active: value === option.value }, buttonClasses]">
<input :value="option.value" v-model="model" type="radio" id="option1" autocomplete="off" checked="">
{{option.label}}
</label>
</div>
</template>
<script>
export default {
name: 'button-radio-group',
props: {
options: {
type: Array,
description: 'Radio options. Should be an array of objects {value: "", label: ""}',
default: () => []
},
value: {
type: String,
description: 'Radio value'
},
buttonClasses: {
type: [String, Object],
description: 'Inner button css classes'
}
},
model: {
prop: 'value',
event: 'change'
},
computed: {
model: {
get() {
return this.value
},
set(val) {
this.$emit('change', val)
}
}
}
}
</script>
<style>
</style>