I would like to add an arrow below with MatTooltip on Angular 16.But for some reason overriding the Material with a pseudo element for an arrow doesnt work as suggested in many posts. Here is my code :
<th class="value-style" matTooltip={{tile.tooltip}} [matTooltipPosition]='tooltipPosition' matTooltipClass="TooltipClass">{{tile.count}}</th>
In Scss
.homeTooltipClass {
.mdc-tooltip__surface {
background: rgba($color:black, $alpha: 1) !important;
background-color: black;
color: white !important;
font-size: 14px !important;
max-width: 200px !important;
border: 1px solid black;
padding: 5px;
box-shadow: 1px 1px black;
}
}
public tooltipPosition: TooltipPosition = "above";
Really I can not imagine how you draw the "arrow", but you need take account three things
The .css should be in a "global" style (e.g. in the styles.css of your application. Material angular create the tooltip in a cdk-panel "outside" the application.
You should indicate overflow:visible to your tooltip
.mat-tooltip.TooltipClass{
overflow: visible;
}
An example of draw a bottom arrow
.mat-tooltip.TooltipClass::after {
content: " ";
position: absolute;
top: 100%; /* At the bottom of the tooltip */
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: rgba(97, 97, 97, .9) transparent transparent transparent;
}
NOTE: in material v16, the class should be mat-mdc-tooltip