All Components

DropDownButton Overview

The DropDownButton component looks like the Button and when clicked, it displays a popup list with action items.

Basic Usage

The following example demonstrates the DropDownButton in action.

@Component({
    selector: 'my-app',
    template: `
        <div class="row">
          <div class="col-xs-12 col-sm-6 col-lg-3 example-col">
            <p>Default Button</p>
            <p class="k-block">
                <kendo-dropdownbutton [data]="data">
                    User Settings
                </kendo-dropdownbutton>
            </p>
          </div>
          <div class="col-xs-12 col-sm-6 col-lg-3 example-col">
            <p>Primary Button</p>
            <p class="k-block">
                <kendo-dropdownbutton [data]="data" [primary]="true">
                    User Settings
                </kendo-dropdownbutton>
            </p>
          </div>
          <div class="col-xs-12 col-sm-6 col-lg-3 example-col">
            <p>Outline Button</p>
            <p class="k-block">
                <kendo-dropdownbutton [data]="data" [look]="'outline'">
                    User Settings
                </kendo-dropdownbutton>
            </p>
          </div>
          <div class="col-xs-12 col-sm-6 col-lg-3 example-col">
            <p>Bare Button</p>
            <p class="k-block">
                <kendo-dropdownbutton [data]="data" [look]="'bare'">
                    User Settings
                </kendo-dropdownbutton>
            </p>
          </div>
        </div>
    `
})
class AppComponent {
    data: Array<any> = [{
        text: 'My Profile'
    }, {
        text: 'Friend Requests'
    }, {
        text: 'Account Settings'
    }, {
        text: 'Support'
    }, {
        text: 'Log Out'
    }];
}

Functionality and Features

Events

The following example demonstrates basic DropDownButton events.

import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `
        <p>
            <kendo-dropdownbutton
                [data]="data"
                (focus)="onFocus()"
                (blur)="onBlur()"
                (close)="onClose()"
                (open)="onOpen()"
                (itemClick)="onItemClick()"
            >
                User Settings
            </kendo-dropdownbutton>
        </p>
        <event-log title="Event log" [events]="events"></event-log>
    `
})

export class AppComponent {
    public data: Array<any> = [
        { text: 'My Profile' },
        { text: 'Friend Requests' },
        { text: 'Account Settings' },
        { text: 'Support' },
        { text: 'Log Out' }
    ];

    public events: string[] = [];

    public onItemClick(): void {
        this.log('item click');
    }

    public onFocus(): void {
        this.log('focus');
    }

    public onBlur(): void {
        this.log('blur');
    }

    public onOpen(): void {
        this.log('open');
    }

    public onClose(): void {
        this.log('close');
    }

    private log(event: string, arg: any): void {
        this.events.push(`${event}`);
    }
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import { AppComponent } from './app.component';
import { EventLogComponent } from './event-log.component';

@NgModule({
    bootstrap:    [AppComponent],
    declarations: [AppComponent, EventLogComponent],
    imports:      [BrowserModule, BrowserAnimationsModule, ButtonsModule]
})
export class AppModule {}
import { Component, Input } from '@angular/core';

@Component({
  selector: 'event-log',
  template: `
    <div class="example-config">
      <h5>{{ title }}</h5>
      <ul class="event-log">
        <li *ngFor="let event of events.reverse()">{{ event }}</li>
      </ul>
    </div>
  `
})
export class EventLogComponent {
  @Input() title: string;
  @Input() events: string[];
}
import { AppModule } from './app.module';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
In this article