Radio Vue Component

Radio Vue component represents Radio component.

Radio Components

There are following components included:

  • f7-radio

Radio Properties

Prop Type Default Description
<f7-radio> properties
checked boolean Defines whether the radio input is checked or not
name string
number
Radio input name
value string
number
boolean
Radio input value
disabled boolean Defines whether the radio input is disabled
readonly boolean Defines whether the radio input is readonly

Radio Events

Event Description
<f7-radio> events
change Event will be triggered when radio input state changed

Radios List

Radios List is not a separate component, but just a particular case of using <f7-list>, <f7-list-item>.

<f7-list>
  <!-- Additional "radio" prop to enable radio list item -->
  <f7-list-item radio value="check_1" name="demo-radio" checked title="Radio 1"></f7-list-item>
  <f7-list-item radio value="check_2" name="demo-radio" title="Radio 2"></f7-list-item>
</f7-list>

Radio v-model

v-model is not supported on Radio vue component. Instead, just use the combination of checked property and @change event:

<template>
  <f7-radio
    name="fruit"
    value="bannana"
    :checked="fruit === 'bannana'"
    @change="fruit = $event.target.value"
  ></f7-radio>

  <f7-radio
    name="fruit"
    value="orange"
    :checked="fruit === 'orange'"
    @change="fruit = $event.target.value"
  ></f7-radio>

  <f7-radio
    name="fruit"
    value="apple"
    :checked="fruit === 'apple'"
    @change="fruit = $event.target.value"
  ></f7-radio>
</template>
<script>
  export default {
    data() {
      return {
        fruit: 'apple'
      };
    },
  };
</script>

Examples

<!-- Inline radio -->
<p>Lorem <f7-radio name="demo-radio-1"></f7-radio> ipsum dolor sit amet, consectetur adipisicing elit. Alias beatae illo nihil aut eius commodi sint eveniet aliquid eligendi <f7-radio name="demo-radio-1" checked></f7-radio> ad delectus impedit tempore nemo, enim vel praesentium consequatur nulla mollitia!</p>

<!-- Radios List -->
<f7-list>
  <f7-list-item radio value="Books" title="Books" name="demo-radio-2" checked></f7-list-item>
  <f7-list-item radio value="Movies" title="Movies" name="demo-radio-2"></f7-list-item>
  <f7-list-item radio value="Food" title="Food" name="demo-radio-2"></f7-list-item>
  <f7-list-item radio value="Drinks" title="Drinks" name="demo-radio-2"></f7-list-item>
</f7-list>