Search results

Setting Dimension

Height and width

The Tooltip can either be assigned auto height and width values or specific pixel values. The width and height properties are used to set the outer dimension of the Tooltip element. The default value for both the properties is auto. It also accepts string and number values in pixels.

The following sample explains how to set dimensions for the Tooltip.

Source
Preview
app.component.ts
app.module.ts
main.ts
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'my-app',
  template: `
    <div id='container'>
        <ejs-tooltip target='.e-info' position='RightCenter'>
        <form id="details" role="form">
            <table>
                <tr>
                    <td class="info">User Name</td>
                    <td>
                        <input type="text" class="e-info" name="firstname" title="Please enter your name"> </td>
                </tr>
                <tr>
                    <td class="info">Email Address</td>
                    <td>
                        <input type="text" class="e-info" name="email" title="Enter a valid email address">
                    </td>
                </tr>
                <tr>
                    <td class="info">Password</td>
                    <td>
                        <input type="password" class="e-info" name="password" title="Be at least 8 characters length">
                    </td>
                </tr>
                <tr>
                    <td class="info">Confirm Password</td>
                    <td>
                        <input type="password" class="e-info" name="Cpwd" title="Re-enter your password">
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="sample" ejs-button class="center" type="submit" value="Submit">
                    </td>
                    <td>
                        <input id="clear" ejs-button type="reset" class="center" value="Reset" style="align-content:  center;">
                    </td>
                </tr>
            </table>
        </form>
        </ejs-tooltip>
    </div>
`,
  encapsulation: ViewEncapsulation.None
})
export class AppComponent  { }


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

@Component({
  selector: 'my-app',
  template: `
    <div id='container' >
        <ejs-tooltip style="display: inline-block; position: relative; left: 50%;top: 100px;transform: translateX(-50%); padding: 60px 40px 40px 0" id='tooltip' width= '180px' height= '40px' content= 'This tooltip has 180px width and 40px height' target="#target">
            <button ejs-button id="target">Show Tooltip</button>
        </ejs-tooltip>
    </div>`,
  encapsulation: ViewEncapsulation.None
})
export class AppComponent  { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { TooltipModule } from '@syncfusion/ej2-angular-popups';
import { ButtonModule } from '@syncfusion/ej2-angular-buttons';
import { AppComponent } from './app.component';

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

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Scroll mode

When height is specified with a certain pixel value and the Tooltip content overflows, the scrolling mode gets enabled.

Source
Preview
app.component.ts
app.module.ts
main.ts
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `
        <p>A green home is a type of house designed to be
            <ejs-tooltip id='tooltip' width='300px' height='60px' isSticky='true' [content]='tooltipContent'>
            <a><u>environmentally friendly</u></a>
            </ejs-tooltip> and sustainable. And also focuses on the efficient use of "energy, water, and building materials." As green homes
            have become more prevalent we have also seen the emergence of green affordable housing.
        </p>
        `,
    encapsulation: ViewEncapsulation.None,
})
export class AppComponent {
    tooltipContent: HTMLElement = document.createElement('div');
    constructor() {
        this.tooltipContent =
            '<div id="tooltipContent"><p><b>Environmentally friendly</b> or environment-friendly, (also referred to as eco-friendly, nature-friendly, and green) are marketing and sustainability terms referring to goods and services, laws, guidelines and policies that inflict reduced, minimal, or no harm upon ecosystems or the environment.</p></div>';
    }
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { TooltipModule } from '@syncfusion/ej2-angular-popups';
import { ButtonModule } from '@syncfusion/ej2-angular-buttons';
import { AppComponent } from './app.component';

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

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

The scrolling mode can best be seen when the sticky mode of the Tooltip is enabled. To enable sticky mode, set the isSticky property to true.