mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 03:38:54 +01:00
chore: move to tsup
This commit is contained in:
72
components/forms/RadioGroup.vue
Normal file
72
components/forms/RadioGroup.vue
Normal file
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<fieldset :id="name">
|
||||
<legend v-if="label" class="sr-only">
|
||||
{{ label }}
|
||||
</legend>
|
||||
|
||||
<div :class="wrapperClass">
|
||||
<Radio
|
||||
v-for="(option, index) in options"
|
||||
:key="index"
|
||||
:checked="option.value === value"
|
||||
:disabled="disabled"
|
||||
:name="name"
|
||||
v-bind="option"
|
||||
:class="inputClass"
|
||||
@change="onChange"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Radio from './Radio'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Radio
|
||||
},
|
||||
model: {
|
||||
event: 'change'
|
||||
},
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
value: {
|
||||
type: [String, Number, Boolean, Object],
|
||||
default: null
|
||||
},
|
||||
options: {
|
||||
type: [Array],
|
||||
required: true
|
||||
},
|
||||
required: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
wrapperClass: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
inputClass: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange (value) {
|
||||
this.$emit('change', value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user