Angular Tooltip Component

The Tooltip component for Angular represents a widget that displays a popup message. The widget can be used in combination with any HTML element. You just need to call the Tooltip's "add" method and pass the HTML element as parameter.

1. Installation

The easiest way to get started with jQWidgets UI for Angular is to use the Angular CLI Tool. To scaffold your project structure, follow its installation instructions.

npm install -g @angular/cli
ng new jqwidgets-project
cd jqwidgets-project

Install jQWidgets

jQWidgets Angular UI comes packaged with Angular CLI schematics to make creating Angular applications easier. Schematics are included with both @angular/cdk and jqwidgets-ng. Once you install the npm packages, they will be available through the Angular CLI.

Angular CLI supports the addition of packages through the ng add command. The ng add command provides faster and more user-friendly package installation. To install the jQWidgets UI for Angular package, use ng add and add the name of the NPM package:

ng add jqwidgets-ng

Alternatively, you can use the standard installation (Manual Setup)

jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package

  1. Download and install the package.
    npm install jqwidgets-ng
  2. Adding CSS reference

    The following CSS file is available in ../node_modules/jqwidgets-ng/ package folder. This can be referenced in [src/styles.css] using following code.

    @import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';

    Another way to achieve the same is to edit the angular.json file and in the styles add the style.

    "styles": [
    	"node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css"
    ]
    

2. Add the HTML for jQWidgets component in src/app/app.component.html

app.component.html


<div id='container'>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>The Amazing Spider-man</i><br /><b>Year:</b> 2012'">
    <img src='https://www.jqwidgets.com/angular/images/The_Amazng_Spider_Man.jpeg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>The Avengers</i><br /><b>Year:</b> 2012'">
    <img src='https://www.jqwidgets.com/angular/images/The_Avengers.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>The Dark Knight Rises</i> <br /><b>Year:</b> 2012'">
    <img src='https://www.jqwidgets.com/angular/images/The_Dark_Knight_Rises.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>Harry Potter and the Deathly Hallows - Part 1</i><br /><b>Year:</b> 2010'">
    <img src='https://www.jqwidgets.com/angular/images/Harry_Potter_7_Part_1.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>Harry Potter and the Deathly Hallows - Part 2</i><br /><b>Year:</b> 2011'">
    <img src='https://www.jqwidgets.com/angular/images/Harry_Potter_7_Part_2.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>Inception</i><br /><b>Year:</b> 2010'">
    <img src='https://www.jqwidgets.com/angular/images/Inception.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>Star Trek</i><br /><b>Year:</b> 2009 '">
    <img src='https://www.jqwidgets.com/angular/images/Star_Trek.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>Star Wars</i> Episode III: <i>Revenge of the Sith</i><br /><b>Year:</b> 2005'">
    <img src='https://www.jqwidgets.com/angular/images/Star_Wars_Episode_III.jpg' />
  </jqxTooltip>
  <jqxTooltip [theme]="'fluent'" [position]="'mouse'" [name]="'movieTooltip'"
              [content]="'<b>Title:</b> <i>Thor</i><br /><b>Year:</b> 2011'">
    <img src='https://www.jqwidgets.com/angular/images/Thor.jpg' />
  </jqxTooltip>
</div>	

3. Setup Component Logic

app.component.ts


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

import { jqxTooltipModule, jqxTooltipComponent } from 'jqwidgets-ng/jqxtooltip';
@Component({
    selector: 'app-root',
    imports: [jqxTooltipModule],
    standalone: true,
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css'],
    encapsulation: ViewEncapsulation.None
})

export class AppComponent {
}

Summary

jQWidgets UI for Angular provides an easy way to integrate robust UI components into your Angular project. By using either the ng add command or manual setup, you can quickly get started. Once the setup is complete, you can add the desired jQWidgets components and configure them in your Angular components to match your application requirements.

Tooltip API

API Reference of the jQWidgets Tooltip component for Angular: Tooltip API