app.component.ts
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
encapsulation: ViewEncapsulation.None,
styles: [`
.tooltip-custom-class {
background: green;
}
`]
})
export class AppComponent { }
app.component.html
<h2>
Angular Material - How to change Tooltip background color
</h2>
<button mat-flat-button
color="primary"
matTooltip="This is a sample material tooltip"
matTooltipClass="tooltip-custom-class"
aria-label="Display a material tooltip in a different
background color on focused or hovered over">
Show 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 appearance
- angular material - How to set Button toggle appearance
- angular material - Button toggle group initially checked items
- angular material - How to show Tooltip
- angular material - Show Tooltip on a specific position
- angular material - How to apply custom css style in Tooltip
- angular material - Show & hide Tooltip on button click
- angular material - Toggle Tooltip visibility on button click
- angular material - How to use Divider
- angular - How to change default font
- angular - How to do a task after a delay
- angular - How to use setInterval()
- angular material - How to change Progress bar height
- angular material - How to change Divider color
- angular material - How to change Progress bar width