Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

Code:

<md-tab-group>
<md-tab label="Tab 1">
    <!-- tooltip with dynamic html content -->
    <div>
        <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>.
        </tooltip-content>

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

</md-tab>
</md-tab-group>
like image 692
Rolando Avatar asked Mar 08 '23 19:03

Rolando


1 Answers

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';

@Component({
  ...
  styleUrls: ["./tabs-overview-example.css"],
  encapsulation: ViewEncapsulation.None
})
  1. In the CSS file, I set the overflow attribute as follows:
md-tab-group,
md-tab-body,
.mat-tab-body-wrapper,
.mat-tab-body-content
{
    overflow: visible !important;
}
like image 64
ConnorsFan Avatar answered Apr 06 '23 14:04

ConnorsFan