Radio group with Custom Item Template


                    var json = {
  "elements": [
      "type": "radiogroup",
      "renderAs": "custom-radiogroup",
      "name": "Radiogroup with custom items rendering",
      "showOtherItem": true,
      "choices": [
        "Button 1",
        "Button 2",
        "Button 3"


                    window.survey = new Survey.Model(json);
            survey.onComplete.add(function(sender) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(, null, 3);
class CustomRadiogroupQuestion extends SurveyReact.SurveyQuestionRadiogroup {
  renderElement() {
    return (
    <div>You can render any additional markup around the question content</div>

  function(props) {
    return React.createElement(CustomRadiogroupQuestion, props);

class MySurveyQuestionRadioItem extends SurveyReact.ReactSurveyElement {
  renderElement() {
    var props = this.props;
    return (
<div className={this.props.question.getItemClass(this.props.item)}>
    <button type="button" onClick={function() {
            if(props.question.isDesignMode) {
        }}>{this.renderLocString(props.item.locText, props.textStyle)}

  function(props) {
    if(props.question.renderAs === "custom-radiogroup") {
      return React.createElement(MySurveyQuestionRadioItem, props);
    return React.createElement(SurveyReact.SurveyQuestionRadioItem, props);

            <SurveyReact.Survey model={survey}  />, document.getElementById("surveyElement"));

<!DOCTYPE html>
<html lang="en">
    <title>Radio group with Custom Item Template, Reactjs Survey Library Example</title>
<meta name="viewport" content="width=device-width" />
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src="/DevBuilds/survey-core/survey.core.min.js"></script>
    <script src="/DevBuilds/survey-core/survey.i18n.min.js"></script>
    <script src="/DevBuilds/survey-react-ui/survey-react-ui.min.js"></script>
    <link href="/DevBuilds/survey-core/defaultV2.min.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">

<body style="margin: 0">
            <div id="surveyElement" style="display:inline-block;width:100%;">
    <div id="surveyResult"></div>

<script type="text/babel" src="./index.js"></script>


Sorry, we can't retrieve the data from server. Please comeback later.

If you want to customize a radiogroup item, follow the steps below:

  1. Implement a component that renders item markup.

  2. Register the component so that it can be accessed by name.
    In React, register the component in ReactElementFactory as shown in the JavaScript tab.

    In Knockout, use techniques native to these libraries:

Why we use cookies.

This site uses cookies to make your browsing experience more convenient and personal. Cookies store useful information on your computer to help us improve the efficiency and relevance of our site for you. In some cases, they are essential to making the site work properly. By accessing this site, you consent to the use of cookies.

For more information, refer to DevSoft Baltic’ privacy policy and cookie policy.