---
title: Drop-Down Menu with Custom Item Template
product: Form Library
description: Our drop-down menu ships with fully customizable choice items. You can add images and descriptions, align text, change fonts - you name it. View a free demo example for JavaScript to learn more.
framework: jQuery
source: https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/jquery
index: https://surveyjs.io/form-library/examples/overview.md
---

# Drop-Down Menu with Custom Item Template (jQuery)

Custom item templates allow you to implement drop-down menu item appearance from scratch, enhance menu item styling, and create complex item layouts. In this demo, a custom template is used to add icons to drop-down menu items.

To customize a drop-down menu item, follow the steps below:

1. Implement a component that renders item markup.          
    The component accepts the item configuration object as a prop. You can use its `value` and `text` properties to access the item's value to be saved in survey results and display text. 

2. Register the component so that it can be accessed by name.          
    In HTML/CSS/JavaScript projects, register the component in `ReactElementFactory` as shown in the `index.js` file.           
    In React, register the component in `ReactElementFactory` as shown in the `SurveyComponent.jsx` file.          
    In Angular, register the component in `AngularComponentFactory` as shown in the `survey.component.ts` file.          
    In Vue.js, use [techniques native to this framework](https://vuejs.org/guide/components/registration).

3. Assign the component name to the Dropdown question's [`itemComponent`](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel#itemComponent) property in the survey JSON schema.

## Files

### `public/index.html`

```html
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/index.css`

```css
.list-item_image {
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
}

.sd-dropdown__input-field-component {
    height: 48px
}
```

### `src/index.js`

```js
import $ from "jquery";
import { Model } from "survey-core";
import "survey-js-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";
import { ReactElementFactory, createElement, Component } from "survey-js-ui";

window.React = { createElement: createElement, Component: Component };
class ItemTemplateComponent extends Component {
    getImageUrl(brand) {
        return ("https://www.carlogos.org/car-logos/" + brand.toLowerCase() + "-logo.png");
    }
    render() {
        const item = this.props.item;
        const logoUrl = this.getImageUrl(item.title);

        return (
            <div className="my-list-item"
                    style={{ display: "flex" }}>
                <img className="list-item_image" src={logoUrl} alt="Logo" />
                <span className="list-item_text">{item.title}</span>
            </div>
        );
    }
}
ReactElementFactory.Instance.registerElement(
  "new-item",
  (props) => {
    return React.createElement(ItemTemplateComponent, props);
  }
);
const survey = new Model(json);
survey.onComplete.add((sender, options) => {
    console.log(JSON.stringify(sender.data, null, 3));
});

$("#surveyElement").Survey({ model: survey });
```

### `src/json.js`

```js
export const 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" ],
      "searchEnabled":  false
    }
  ]
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

```json
{
  "dependencies": {
    "jquery": "latest",
    "babel": "latest",
    "survey-core": "latest",
    "survey-js-ui": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/angular.md)
- [React](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/vue3js.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/dropdown-box-with-custom-items/vanillajs.md)
