Your search did not match any results.
Radio Group

Radio Group


The RadioGroup is a widget that contains a set of radio buttons and allows an end user to make a single selection from the set. This demo illustrates how to change the widget layout, define a custom template and handle the value change event.

Copy to CodeSandBox
<template> <div class="form"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Default mode</div> <div class="dx-field-value"> <dx-radio-group :items="priorities" :value="priorities[0]" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> <dx-radio-group :items="priorities" :value="priorities[1]" :disabled="true" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Horizontal layout</div> <div class="dx-field-value"> <dx-radio-group :items="priorities" :value="priorities[0]" layout="horizontal" /> </div> </div> <div class="dx-field"> <div class="dx-field-label">Custom item template</div> <div class="dx-field-value"> <div id="radio-group-with-template"> <div :class="colorPriority.toLowerCase()"> <dx-radio-group :items="priorities" v-model="colorPriority" /> </div> </div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Event handling</div> <div class="dx-field-value"> <div id="radio-group-with-selection"> <dx-radio-group :items="priorities" :value="selectionPriority" @valueChanged="changeSelectionPriority" /> </div> </div> </div> </div> <div id="tasks-list"> Tasks by selected priority: <ul id="list"> <li v-for="task in selectedTasks" :key="" >{{ task.subject }}</li> </ul> </div> </div> </template> <script> import { DxRadioGroup } from 'devextreme-vue'; import { priorities, tasks } from './data.js'; export default { components: { DxRadioGroup }, data() { return { priorities, tasks, colorPriority: priorities[2], selectionPriority: priorities[0] }; }, computed: { selectedTasks() { return tasks.filter(task => task.priority == this.selectionPriority); } }, methods: { changeSelectionPriority(e) { this.selectionPriority = e.value; } } }; </script>
import Vue from 'vue'; import App from './App.vue'; new Vue({ el: '#app', components: { App }, template: '<App/>' });
<!DOCTYPE html> <html> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src=""></script> <script src=""></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> <span v-if="false">Loading...</span> </div> </div> </body> </html>
.low .dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: gray; } .normal .dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: green; } .urgent .dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: orange; } .high .dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: red; } #radio-group-with-selection { margin: 5px 0 10px 0px; } #radio-group-with-template { margin: 5px 0; } #tasks-list { margin: 0 0 10px 10px; white-space: normal; } #list { margin: 10px 0 0 20px; padding-left: 0; text-align: left; }
export const priorities = ['Low', 'Normal', 'Urgent', 'High']; export const tasks = [{ id: 0, subject: 'Choose between PPO and HMO Health Plan', priority: 'High' }, { id: 1, subject: 'Non-Compete Agreements', priority: 'Low' }, { id: 2, subject: 'Comment on Revenue Projections', priority: 'Normal' }, { id: 3, subject: 'Sign Updated NDA', priority: 'Urgent' }, { id: 4, subject: 'Submit Questions Regarding New NDA', priority: 'High' }, { id: 5, subject: 'Rollout of New Website and Marketing Brochures', priority: 'High' }];
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': '' }, map: { vue: 'npm:vue@2.6.3/dist/vue.esm.browser.js', 'vue-loader': 'npm:systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.1', 'devextreme-vue': 'npm:devextreme-vue@19.1', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.6/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, meta: { '*.vue': { loader: 'vue-loader' } }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });