DropDowns Overview
The DropDowns allow you to choose from a predefined list of options.
A list of suggestions for typed content.
A list for picking single items or entering custom values.
A predefined list of options for picking single values.
A predefined list of options for multiple item selection.
Basic Usage
The following example demonstrates the AutoComplete, ComboBox, DropDownList, and MultiSelect components in action.
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<div class="example-wrapper" style="min-height: 400px;">
<div class="col-xs-12 col-sm-6 example-col">
<p>AutoComplete</p>
<kendo-autocomplete [data]="listItems" [placeholder]="'Your favorite sport'">
</kendo-autocomplete>
</div>
<div class="col-xs-12 col-sm-6 example-col">
<p>ComboBox</p>
<kendo-combobox [data]="listItems" [value]="'Basketball'">
</kendo-combobox>
</div>
<div class="col-xs-12 col-sm-6 example-col">
<p>DropDownList</p>
<kendo-dropdownlist [data]="listItems" [value]="'Basketball'">
</kendo-dropdownlist>
</div>
<div class="col-xs-12 col-sm-6 example-col">
<p>MultiSelect</p>
<kendo-multiselect [data]="listItems" [value]="value" [placeholder]="'Your favorite sports'"></kendo-multiselect>
</div>
</div>
`
})
export class AppComponent {
public listItems: Array<string> = [
'Baseball', 'Basketball', 'Cricket', 'Field Hockey',
'Football', 'Table Tennis', 'Tennis', 'Volleyball'
];
public value = ['Basketball', 'Cricket'];
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule, HttpClientJsonpModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
HttpClientJsonpModule,
DropDownsModule
],
declarations: [
AppComponent
],
bootstrap: [
AppComponent
]
})
export class AppModule { }
import { AppModule } from './ng.module';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
Installation
All components that you reference during the installation will be present in the final bundle of your application. To avoid ending up with components you do not actually need, either:
- Import all DropDowns components at once by using the DropDownsModule, or
- Import a specific DropDowns component by adding it as an individual NgModule.
The latest versions of this package (v2 or later) require you to install RxJS v5.5 or later. Before you use the DropDowns components, run
npm install --save rxjs@^5.5
.
-
Download and install the package:
npm install --save @progress/kendo-angular-dropdowns @progress/kendo-angular-l10n @angular/animations
-
Once installed, import the NgModule of the components you need.
To get all package components, import the DropDownsModule in your application root module:
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { DropDownsModule } from '@progress/kendo-angular-dropdowns'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [AppComponent], declarations: [AppComponent], imports: [BrowserModule, BrowserAnimationsModule, DropDownsModule] }) export class AppModule { }
The package also exports the following modules for individual components:
- AutoCompleteModule
- ComboBoxModule
- DropDownListModule
- MultiSelectModule
To reduce the size of your application, include only the ones you need:
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; // Imports the AutoComplete module import { AutoCompleteModule } from '@progress/kendo-angular-dropdowns'; // Imports the ComboBox module import { ComboBoxModule } from '@progress/kendo-angular-dropdowns'; @NgModule({ bootstrap: [AppComponent], imports: [ BrowserModule, BrowserAnimationsModule, AutoCompleteModule, ComboBoxModule ] }) export class AppModule {}
You are required to install one of the Kendo UI themes for Angular to style your components. For more information on how to add the styles, refer to the article on getting started.
Dependencies
The DropDowns package requires you to install the following peer dependencies in your application:
- @angular/common
- @angular/core
- @angular/forms
- @progress/kendo-angular-l10n
- rxjs
The following dependencies will be installed automatically:
- @progress/kendo-angular-popup
- @progress/kendo-angular-resize-sensor
- @telerik/kendo-dropdowns-common
- The version of the @angular/animations module has to be exactly the same as the version of the other @angular modules that are included in your project. To sync the package versions, you might need to run
npm update
.- The DropDowns package utilizes the Angular animation system, which supports a specific set of browsers.