aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/StudipRadioButtonGroup.vue
diff options
context:
space:
mode:
Diffstat (limited to 'resources/vue/components/StudipRadioButtonGroup.vue')
-rw-r--r--resources/vue/components/StudipRadioButtonGroup.vue42
1 files changed, 42 insertions, 0 deletions
diff --git a/resources/vue/components/StudipRadioButtonGroup.vue b/resources/vue/components/StudipRadioButtonGroup.vue
new file mode 100644
index 0000000..e5fd5e7
--- /dev/null
+++ b/resources/vue/components/StudipRadioButtonGroup.vue
@@ -0,0 +1,42 @@
+<script setup lang="ts">
+import {computed, onMounted} from "vue";
+import StudipRadioButton from "./StudipRadioButton.vue";
+
+const props = defineProps<{
+ label: string;
+ modelValue: string | number | boolean;
+ name: string;
+ options: Record<string, string>
+}>();
+
+const emit = defineEmits(['update:modelValue']);
+
+const model = computed({
+ get() {
+ return props.modelValue;
+ },
+ set(newValue) {
+ emit('update:modelValue', newValue);
+ }
+})
+
+onMounted(() => {
+ document.addEventListener('focusin', event => console.log('focussed', event.target), {capture: true})
+})
+
+</script>
+<template>
+ <div role="radiogroup"
+ :aria-label="props.label"
+ >
+ <StudipRadioButton v-for="(optionLabel, key) in options"
+ :key="key"
+ :value="key"
+ :name="name"
+ v-model="model"
+ >
+ {{ optionLabel }}
+ </StudipRadioButton>
+
+ </div>
+</template>