This guide provides the information you need to start using the Kendo UI for Angular DropDowns—it includes instructions about the recommended installation approach, the code for running the project, and links to additional resources.
As of version
17.0.0
, Angular makes standalone component enabled by default. If you useNgModules
, refer to these articles:
The standalone components in Angular streamline development by removing the need for NgModules
, reducing complexity, and enhancing component reuse and modularity. This approach simplifies dependency management, making applications more maintainable and scalable.
After the completion of this guide, you will be able to achieve an end result as demonstrated in the following example.
Before you start with the installation of any Kendo UI for Angular control, ensure that you have a running Angular project. The prerequisites to accomplish the installation of the components are always the same regardless of the Kendo UI for Angular package you want to use, and are fully described in the section on setting up your Angular project.
The following command demonstrates an efficient, automated method for adding packages using the Angular CLI through the ng-add
command. This approach saves time and effort by executing a series of commands in a single step, which otherwise need to be run individually. Refer to the Manual Setup for more details.
To add the Kendo UI for Angular DropDowns package:
Run the following command.
ng add @progress/kendo-angular-dropdowns
As a result, the ng-add
command will perform the following actions:
@progress/kendo-angular-dropdowns
package as a dependency to the package.json
file.package.json
file.angular.json
file.npm install
to install the theme and all peer packages that are added.Import the required components, directives and utility arrays:
The utility arrays are available starting from
v16.6.0
. If you use an older version of the package, please follow the approach from the Using Kendo Angular Components with NgModules article.
To add all components from the DropDowns package, import the KENDO_DROPDOWNS
utility array in your standalone component.
import { Component } from '@angular/core';
import { KENDO_DROPDOWNS } from '@progress/kendo-angular-dropdowns';
@Component({
standalone: true,
selector: 'my-app',
imports: [KENDO_DROPDOWNS]
})
To add individual DropDowns components, import the corresponding utility arrays in your standalone component. See the list of available utility arrays.
For example if you only need the DropDownList component, import KENDO_DROPDOWNLIST
.
import { Component } from '@angular/core';
import { KENDO_DROPDOWNLIST } from '@progress/kendo-angular-dropdowns';
@Component({
standalone: true,
selector: 'my-app',
imports: [KENDO_DROPDOWNLIST]
})
After successfully installing the DropDowns package and importing the required components and directives, add the corresponding tags of the components you need in the app.component.html
. For example, if you need the DropDownList, add the following code:
<kendo-dropdownlist [data]="listItems"></kendo-dropdownlist>
Create the data source in your app.component.ts
file:
export class AppComponent {
public listItems: Array<string> = [
"Item 1",
"Item 2",
"Item 3"
];
}
Build and serve the application by running the following command in the root folder.
ng serve
Point your browser to http://localhost:4200 to see the Kendo UI for Angular DropDownList component on the page.
As of December 2020, using any of the UI components from the Kendo UI for Angular library requires either a commercial license key or an active trial license key. If your application does not contain a Kendo UI license file, activate your license key.