Radio Vue Component

Radio Vue component represents Radio component.

Radio Components

There are following components included:

Radio Properties

PropTypeDefaultDescription
<f7-radio> properties
checkedbooleanDefines whether the radio input is checked or not
namestring
number
Radio input name
valuestring
number
boolean
Radio input value
disabledbooleanDefines whether the radio input is disabled
readonlybooleanDefines whether the radio input is readonly

Radio Events

EventDescription
<f7-radio> events
changeEvent 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

Radio Vue component supports v-model on checked property:

<template>
  <f7-page>
    <f7-radio v-model:checked="carsSelected" />
    <f7-radio v-model:checked="booksSelected" />
    <p>Cars selected: {{ carsSelected }}</p>
    <p>Books selected: {{ booksSelected }}</p>
  </f7-page>
</template>
<script>
  export default {
    data() {
      return {
        carsSelected: false,
        booksSelected: false,
      };
    }
  };
</script>

Examples

radio.vue
<template>
  <f7-page>
    <f7-navbar title="Radio"></f7-navbar>
    <f7-block-title>Inline</f7-block-title>

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

    <f7-block-title>Radio Group</f7-block-title>
    <f7-list strong-ios outline-ios dividers-ios>
      <f7-list-item radio radio-icon="start" title="Books" name="demo-radio-start" checked />
      <f7-list-item radio radio-icon="start" title="Movies" name="demo-radio-start" />
      <f7-list-item radio radio-icon="start" title="Food" name="demo-radio-start" />
      <f7-list-item radio radio-icon="start" title="Drinks" name="demo-radio-start" />
    </f7-list>

    <f7-list strong-ios outline-ios dividers-ios>
      <f7-list-item radio radio-icon="end" title="Books" name="demo-radio-end" checked />
      <f7-list-item radio radio-icon="end" title="Movies" name="demo-radio-end" />
      <f7-list-item radio radio-icon="end" title="Food" name="demo-radio-end" />
      <f7-list-item radio radio-icon="end" title="Drinks" name="demo-radio-end" />
    </f7-list>

    <f7-block-title>With Media Lists</f7-block-title>
    <f7-list media-list strong-ios outline-ios dividers-ios>
      <f7-list-item
        radio
        radio-icon="start"
        checked
        name="demo-media-radio"
        value="1"
        title="Facebook"
        after="17:14"
        subtitle="New messages from John Doe"
        text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
      />
      <f7-list-item
        radio
        radio-icon="start"
        name="demo-media-radio"
        value="2"
        title="John Doe (via Twitter)"
        after="17:11"
        subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
        text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
      />
      <f7-list-item
        radio
        radio-icon="start"
        name="demo-media-radio"
        value="3"
        title="Facebook"
        after="16:48"
        subtitle="New messages from John Doe"
        text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
      />
      <f7-list-item
        radio
        radio-icon="start"
        name="demo-media-radio"
        value="4"
        title="John Doe (via Twitter)"
        after="15:32"
        subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
        text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
      />
    </f7-list>
  </f7-page>
</template>
<script>
import {
  f7Navbar,
  f7Page,
  f7BlockTitle,
  f7Block,
  f7List,
  f7ListItem,
  f7Radio,
} from 'framework7-vue';

export default {
  components: {
    f7Navbar,
    f7Page,
    f7BlockTitle,
    f7Block,
    f7List,
    f7ListItem,
    f7Radio,
  },
};
</script>