@progress/kendo-dropdowns-react-wrapper
Version:
Kendo UI DropDowns wrapper for React
74 lines (64 loc) • 2.4 kB
Markdown
---
title: Templates
page_title: Templates - DropDownList - Kendo UI Wrappers for React
description: "Customize the content of the suggested list items and the drop-down list elements of a Kendo UI DropDownList wrapper for React."
slug: templates_dropdownlist
position: 3
---
# Templates
The DropDownList provides full control over the way an item or a popup header is rendered by using the [Kendo UI templates](http://docs.telerik.com/kendo-ui/framework/templates/overview).
```jsx-preview
class DropDownListContainer extends React.Component {
constructor(props) {
super(props);
this.dataSource = new kendo.data.DataSource({
data: props.data
})
this.template = "<span>This is #:data# with template</span>"
}
render() {
return (
<div className="row">
<div className="col-xs-12 col-sm-6 example-col">
<DropDownList dataSource={this.dataSource}
template={this.template}/>
</div>
</div>
);
}
}
ReactDOM.render(
<DropDownListContainer data={["Baseball", "Basketball", "Cricket", "Field Hockey", "Football", "Table Tennis", "Tennis", "Volleyball"]}/>,
document.querySelector('my-app')
);
```
The DropDownList also displays a `noDataTemplate` template in the popup when the data source is empty.
```jsx
class DropDownListContainer extends React.Component {
constructor(props) {
super(props);
this.dataSource = new kendo.data.DataSource({
data: props.data
})
this.noDataTemplate = "<strong>No Data!</strong>"
}
render() {
return (
<div className="row">
<div className="col-xs-12 col-sm-6 example-col">
<DropDownList dataSource={this.dataSource}
noDataTemplate={this.noDataTemplate}/>
</div>
</div>
);
}
}
ReactDOM.render(
<DropDownListContainer data={[]}/>,
document.querySelector('my-app')
);
```
## Suggested Links
* [Kendo UI Templates](http://docs.telerik.com/kendo-ui/framework/templates/overview)
* [Kendo UI DropDownList for jQuery](https://docs.telerik.com/kendo-ui/controls/editors/dropdownlist/overview)
* [API Reference of the DropDownList Widget](https://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist)