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-color: LightBlue;
font-size: 16px;
font-style: italic;
padding: 8px;
border-bottom: 4px solid Navy;
color: Black !important;
}
`]
})
export class AppComponent { }
app.component.html
<h2>
Angular Material - Apply custom css style in Tooltip
</h2>
<div style="padding:50px;">
<button mat-flat-button
color="primary"
matTooltip="Sample material tooltip with custom css style"
matTooltipClass="tooltip-custom-class"
matTooltipPosition="right"
aria-label="Display a material tooltip with custom
css style on focused or hovered over">
Show Tooltip
</button>
</div>
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 - Button toggle group initially checked items
- angular material - How to show Tooltip
- angular material - Show Tooltip on a specific position
- angular material - How to change Tooltip background color
- angular material - Show & hide Tooltip on button click
- angular material - Toggle Tooltip visibility on button click
- angular material - How to use Divider
- angular material - How to use Card
- angular material - How to use Tabs
- angular material - How to use custom label in Tabs
- angular material - How to use custom Badge size
- angular material - How to show custom color in Badge