I am using ngx-tooltip within angular-material, but the tooltip is being cut off, any way to adjust z-index?


I am using ngx-tooltip (https://www.npmjs.com/package/ngx-tooltip) with angular.material.io tabs and am running into an issue where the tooltip appears to get cut off on the left side when inside of the md-tab container. How do I make it such that the tooltip floats above everything? Is there some way I can adjust the z-index of the tooltip or is there some other way?


<md-tab label="Tab 1">
    <!-- tooltip with dynamic html content -->
        <tooltip-content #myTooltip>
            <b>Very</b> <span style="color: #C21F39">Dynamic</span> <span style="color: #00b3ee">Reusable</span> 
            <b><i><span style="color: #ffc520">Tooltip With</span></i></b> <small>Html support</small>.

        <button [tooltip]="myTooltip">hover this button to see a tooltip</button>



I reproduced your problem in this plunker. In order to make the tooltip visible outside of the md-tab container, I had to do the following (see this corrected plunker):

  1. In the Component decorator, I set the encapsulation to ViewEncapsulation.None:
import {ViewEncapsulation} from '@angular/core';

  styleUrls: ["./tabs-overview-example.css"],
  encapsulation: ViewEncapsulation.None
  1. In the CSS file, I set the overflow attribute as follows:
    overflow: visible !important;

Answered By – ConnorsFan

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.