Files
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

69 lines
1.5 KiB
Vue

<template>
<div class="radio-card" :class="classNames" @click="select(value)">
<div class="radio-card__input">
<Radio :value="value" :model-value="modelValue" />
</div>
<div class="radio-card__content">
<div class="radio-card__labels">
<label class="radio-card__label">{{ label }}</label>
<div v-if="sideLabel">
<Badge :rounded="true" :small="true">{{ sideLabel }}</Badge>
</div>
</div>
<div v-if="hasSlot" class="radio-card__description">
<slot></slot>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'RadioCard',
props: {
value: {
type: [String, Number, Boolean, Object],
required: false,
default: '',
},
modelValue: {
type: [String, Number, Boolean, Object],
required: false,
default: '',
},
label: {
type: String,
required: true,
},
sideLabel: {
type: String,
required: false,
default: undefined,
},
},
emits: ['input', 'update:modelValue'],
computed: {
classNames() {
return {
'radio-card--selected': this.modelValue === this.value,
}
},
selected() {
return this.modelValue === this.value
},
hasSlot() {
return !!this.$slots.default
},
},
methods: {
select(value) {
if (this.disabled || this.selected) {
return
}
this.$emit('input', value)
this.$emit('update:modelValue', value)
},
},
}
</script>