@progress/kendo-dropdowns-react-wrapper
Version:
Kendo UI DropDowns wrapper for React
74 lines (64 loc) • 2.34 kB
Markdown
---
title: Templates
page_title: Templates - ComboBox - Kendo UI Wrappers for React
description: "Customize the content of the suggested list items and the drop-down list elements of a Kendo UI ComboBox wrapper for React."
slug: templates_combobox
position: 3
---
# Templates
The ComboBox 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 ComboBoxContainer 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">
<ComboBox dataSource={this.dataSource}
template={this.template}/>
</div>
</div>
);
}
}
ReactDOM.render(
<ComboBoxContainer data={["Baseball", "Basketball", "Cricket", "Field Hockey", "Football", "Table Tennis", "Tennis", "Volleyball"]}/>,
document.querySelector('my-app')
);
```
The ComboBox also displays a `noDataTemplate` template in the popup when the data source is empty.
```jsx
class ComboBoxContainer 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">
<ComboBox dataSource={this.dataSource}
noDataTemplate={this.noDataTemplate}/>
</div>
</div>
);
}
}
ReactDOM.render(
<ComboBoxContainer data={[]}/>,
document.querySelector('my-app')
);
```
## Suggested Links
* [Kendo UI Templates](http://docs.telerik.com/kendo-ui/framework/templates/overview)
* [Kendo UI ComboBox for jQuery](https://docs.telerik.com/kendo-ui/controls/editors/combobox/overview)
* [API Reference of the ComboBox Widget](https://docs.telerik.com/kendo-ui/api/javascript/ui/combobox)