All Components

Tooltip Overview

The Tooltip represents a popup with information that is related to an UI element and which is displayed when this UI element is focused or hovered over.

Basic Usage

The following example demonstrates the Tooltip in action.

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

@Component({
    selector: 'my-app',
    template: `
       <div kendoTooltip filter="span" id="agglomerations">
           <span href="#" title="Canton - 26,300,000" id="canton"></span>
           <span href="#" title="Jakarta - 25,800,000" id="jakarta"></span>
           <span href="#" title="Mexico City - 23,500,000" id="mexico"></span>
           <span href="#" title="Delhi - 23,500,000" id="delhi"></span>
           <span href="#" title="Karachi - 22,100,000" id="karachi"></span>
           <span href="#" title="New York - 21,500,000" id="newyork"></span>
           <span href="#" title="Sao Paulo - 21,300,000" id="saopaolo"></span>
           <span href="#" title="Mumbay/Bombay - 21,100,000" id="bombay"></span>
           <span href="#" title="Los Angeles - 17,100,000" id="losangeles"></span>
           <span href="#" title="Osaka - 16,800,000" id="osaka"></span>
           <span href="#" title="Moscow - 16,200,000" id="moscow"></span>
       </div>
    `,
    styles: [`
        #agglomerations {
            position: relative;
            width: 692px;
            height: 480px;
            margin: 0 auto;
            background: url('https://www.telerik.com/kendo-angular-ui-develop/components/tooltip/assets/world-map.jpg') no-repeat 0 0;
        }

        #agglomerations > span {
            cursor: pointer;
            position: absolute;
            display: block;
            width: 12px;
            height: 12px;
            background-color: #fff600;
            border-radius: 30px;
            border: 0;
            box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
            transition:  box-shadow .3s;
            z-index: 10;
        }

        #agglomerations > span:hover {
            box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
        }

        #canton { top: 226px; left: 501px; }
        #jakarta { top: 266px; left: 494px; }
        #mexico { top: 227px; left: 182px; }
        #delhi { top: 214px; left: 448px; }
        #karachi { top: 222px; left: 431px; }
        #newyork { top: 188px; left: 214px; }
        #saopaolo { top: 304px; left: 248px; }
        #bombay { top: 233px; left: 438px; }
        #losangeles { top: 202px; left: 148px; }
        #osaka { top: 201px; left: 535px; }
        #moscow { top: 153px; left: 402px; }
    `]
})

export class AppComponent {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TooltipModule } from '@progress/kendo-angular-tooltip';
import { AppComponent } from './app.component';

@NgModule({
    bootstrap:    [AppComponent],
    declarations: [AppComponent],
    imports:      [BrowserModule, BrowserAnimationsModule, TooltipModule]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

Installation

Either use the quick setup (Angular CLI v6 or later) or manually add the package (Angular CLI v5 or earlier).

Quick Setup with Angular CLI v6 or Later

Angular CLI v6 supports the addition of packages through the ng add command which executes in one step the set of otherwise individually needed commands.

ng add @progress/kendo-angular-tooltip

Manual Setup

  1. Download and install the package.

    npm install --save @progress/kendo-angular-tooltip @progress/kendo-angular-l10n
  2. For Angular 6, install the rxjs-compat package. For more information, refer to the article on upgrading to Angular 6.

    npm install --save rxjs-compat@6

    For Angular 5 or earlier, install RxJS v5.5+.

    npm install --save rxjs@^5.5
  3. Once installed, import the TooltipModule in your application root or feature module.

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    
    import { TooltipModule } from '@progress/kendo-angular-tooltip';
    import { AppComponent } from './app.component';
    
    @NgModule({
       bootstrap:    [AppComponent],
       declarations: [AppComponent],
       imports:      [BrowserModule, BrowserAnimationsModule, TooltipModule]
    })
    export class AppModule {}
  4. You are required to install one of the Kendo UI themes for Angular to style your component. For more information on how to add the styles, refer to the section on styling.

Dependencies

The Tooltip package requires you to install the following peer dependencies in your application:

  • @angular/common
  • @angular/core

Functionality and Features

In this article