app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
isDisabled:boolean = false;
onClick(){
this.isDisabled = !this.isDisabled;
}
}
app.component.html
<h2>
Angular Material - How to enable disable Tooltip
</h2>
<h1>Tooltip now {{isDisabled? 'disabled' : 'enabled'}}.</h1>
<button mat-flat-button
color="warn"
matTooltip="Sample material tooltip"
[matTooltipDisabled]="isDisabled"
(click)="onClick()"
aria-label="Display a material tooltip when it is enabled
on focused or hovered over">
{{isDisabled? 'Enable Tooltip' : 'Disable Tooltip'}}
</button>
app.module.ts [import]
// for material button
import {MatButtonModule} from '@angular/material/button';
// for material tooltip
import {MatTooltipModule} from '@angular/material/tooltip';
- angular material - Button toggle group icon only
- angular material - Icon only Button toggle
- angular material - Vertical Button toggle group
- angular material - Show Tooltip on a specific position
- angular material - How to change Tooltip background color
- angular material - How to apply custom css style in Tooltip
- angular material - How to set Tooltip show hide delay
- angular material - Show & hide Tooltip on button click
- angular material - Toggle Tooltip visibility on button click
- angular material - How to use Divider
- angular material - Progress bar with percentage
- angular material - How to use indeterminate Progress bar
- angular material - How to use buffer Progress bar
- angular material - Action list with button and icon
- angular material - How to use Selection List