Dropdown with Custom Item Template


                    var json = {
  "elements": [
      "type": "dropdown",
      "name": "car",
      "title": "Which is the brand of your car?",
      "itemComponent": "new-item",
      "isRequired": true,
      "choices": [ "Ford", "Vauxhall", "Volkswagen", "Nissan", "Audi", "Mercedes-Benz", "BMW", "Peugeot", "Toyota", "Citroen" ]
  "showQuestionNumbers": "off"

                    window.survey = new Survey.Model(json);
            survey.onComplete.add(function(sender) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(sender.data, null, 3);
Vue.component("new-item", {
    props: {
        item: {},
    created: function () {
        const item = this.item;
        item.logoUrl = ("https://www.carlogos.org/car-logos/" + item.title.toLowerCase() + "-logo.png");
    template: `
<div class="my-list-item" style="display:flex;">
    <img class="list-item_image" v-bind:src="item.logoUrl" alt="Logo" />
    <span class="list-item_text">{{ item.title }}</span>
            var app = new Vue({
            el: '#surveyElement',
            survey: survey

<!DOCTYPE html>
<html lang="en">
    <title>Dropdown with Custom Item Template, Vue Survey Library Example</title>
<meta name="viewport" content="width=device-width" />
    <script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></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-vue-ui/survey-vue-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%;">
                                    <survey :survey='survey' />
    <div id="surveyResult"></div>

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


.list-item_text {
    padding: 10px;

.list-item_image {
    width: 60px;
    height: 45px;
    vertical-align: middle;
Sorry, we can't retrieve the data from server. Please comeback later.

If you want to customize a drop-down menu item, follow the steps below:

  1. Implement a component that renders item markup.
    The item is an IAction object. You can use component props to access it.

  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 Vue and Knockout, use techniques native to these libraries:

  3. Assign the component name to the Dropdown question's itemComponent property in the survey JSON definition.

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.