How to show Tooltip on disabled elements in Angular Tooltip
26 Sep 20262 minutes to read
By default, Angular Tooltip do not display on disabled elements. However, you can enable this behavior by following the steps below.
- Add a disabled element, such as a
button, inside adivwithdisplaystyle set toinline-block. - Set the pointer event to
nonefor the disabled element (button) using CSS. - Initialize the Angular Tooltip for the outer
divelement.
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 { Component } from '@angular/core';
@Component({
imports: [
TooltipModule,
ButtonModule
],
standalone: true,
selector: 'my-app',
template: `
<ejs-tooltip id="tooltip" content='Tooltip from disabled element'>
<div><input ejs-button type="button" disabled value="Disabled button" /></div>
</ejs-tooltip>
`,
styles: [`
#tooltip {
display: inline-block;
position: relative;
top:50px;
left: 40%;
}
#tooltip [disabled] {
pointer-events: none;
font-size: 22px;
padding: 10px;
}
`]
})
export class AppComponent {
}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
bootstrapApplication(AppComponent).catch((err) => console.error(err));