Radio

Reference

v-modelundefined
ArrayBooleanString
Radio v-model

base"radio"
String
Base name used to style component

labelempty string
String
Radio label

mod-labelempty string
String
Style of the label element

mod-radioempty string
String
Style of the main input element

nameempty string
String
Name of the component

rules[]
Object
Rules for validation. See Form Validation for examples of rules

validate-mode"silent"
String
Valid values are 'silent' or 'eager'. See Form Validation for explanation and examples

validation-statenull
String
Overrides state of input validity. Supported values are 'valid', 'invalid', empty string for default state or null for component controlled state

variantempty string
String
Active variant of the element mod-* props

Example - props

    <template>
  <div class="flex items-center my-2">
    <v-radio
      v-model="example.model"
      :validationState="example.validationState"
      value="option"
      id="option"
    ></v-radio>
    <label
      for="option"
      class="ml-3"
    >
      option
    </label>
  </div>

  <div class="flex items-center my-2">
    <v-radio
      v-model="example.model"
      :validationState="example.validationState"
      value="option 2"
      id="option2"
    ></v-radio>
    <label
      for="option2"
      class="ml-3"
    >
      option 2
    </label>
  </div>

  <div class="flex items-center my-2">
    <v-radio
      v-model="example.model"
      :validationState="example.validationState"
      value="option 3"
      id="option3"
    ></v-radio>
    <label
      for="option3"
      class="ml-3"
    >
      option 3
    </label>
  </div>

</template>
  
    <script setup>
import { ref, reactive } from "vue";

let example = reactive({
  model: "",
});

let events = ref([]);
</script>
  

Example - radio group

Radio inputs can be optionally wrapped with v-radio-group to create group with single v-model.

Language:
    <template>
  <v-radio-group v-model="language">
    <v-radio
      v-for="l in languagesData"
      :value="l"
      :id="'language-' + l"
      :label="l"
      class="my-2"
    ></v-radio>
  </v-radio-group>

  <div class="mt-5">
    <span class="font-semibold">Language:</span>
    {{ language }}
  </div>
</template>
  
    <script setup>
import { ref } from "vue";

let language = ref("");

let languagesData = ref([
  "english",
  "swedish",
  "korean",
  "german",
  "icelandic",
  "japanese",
]);
</script>