DevExtreme v24.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

React Radio Group

The RadioGroup component contains a set of radio buttons and allows users to select one item from it. This demo illustrates how to bind the component to data, change the component layout, define a custom template, and handle the value change event.

DevExtreme Accessibility Compliance
DevExtreme component libraries meet a variety of WCAG and Section 508 compliance standards. To assess this demo’s accessibility level, click the Run AXE® Validation button to launch the AXE® web accessibility evaluation tool.
All trademarks or registered trademarks are property of their respective owners. AXE® Terms of Use
The overall accessibility level of your application depends on the RadioGroup features used.
To give you the ability to edit code on the fly, the demo uses SystemJS. For this reason, launching the demo takes some time. We strongly recommend that you do not use this approach in real projects.
Backend API

Bind RadioGroup to Data

You can display RadioGroup items from the items array or a dataSource. If your data is an array of objects, use the displayExpr and valueExpr properties. displayExpr specifies a data source field that contains button captions. valueExpr specifies a data source field that supplies values to the value property when users select a button. Leave valueExpr unspecified if you need to supply the entire data object to the value property.

Configure the Layout

The RadioGroup supports horizontal (default for tablets) and vertical (default for other devices) layouts. To change the layout for all device types, specify the layout property.

Customize the Item Appearance

Define the itemTemplate to customize the item appearance. To customize an individual item, specify its template property.

Handle the Value Change Event

You can set the value property to one of the data source items to specify a predefined selection. Implement the onValueChanged function to handle value changes.