question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I would like to be able to put custom style to tooltips template.

I don’t really know how that kind of thing are handled in other library but just being able to inject css in the component style would already be quite usefull.

I already tried to reach the tooltips level with ::ng-deep like this:

Html:

<ng-template #tooltipTemplate let-model="model" class="tooltip">
    This is the single point tooltip template
   <pre class="test">{{model|json}}</pre>
</ng-template>

Less:

.tooltip::ng-deep {
  background-color: @white !important;
  border: 1px solid @silver !important;
 }

But it didn’t work, maybe there is a workaround ?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15

github_iconTop GitHub Comments

11reactions
rtodocommented, Jul 25, 2019

@rtodo You have to wrap your data with a container and apply the class to it, not the template. So something like:

<ng-template #tooltipTemplate let-model="model">
    <div class="tooltip">
        This is the single point tooltip template
       <pre class="test">{{model|json}}</pre>
   </div>
</ng-template>

no need ::ng-deep

But what if I want to change the tooltip container background color ?

5reactions
akotynskicommented, Dec 6, 2019

Tooltip is a global element and cannot be styled with ::ng-deep. I was able to style the tooltip using global css styles:

ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip {
  .tooltip-caret.position-top {
    border-top-color: white;
    box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2);
  }

  background-color: white;
  box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Tooltip
Create a tooltip that appears when the user moves the mouse over an element: Example. <style> /* Tooltip container */ .tooltip { position:...
Read more >
Creating beautiful tooltips with only CSS
This tutorial shows you how to create, position, and animate a tooltip using only CSS without any additional HTML elements.
Read more >
The Best Looking CSS Tooltip Examples You Can Actually ...
CSS tooltips are excellent web tools to provide quick and simple explanations. These include additional details, word definitions, and ...
Read more >
How to style the alt tooltip in html? [duplicate]
You cannot design the default tooltip (i.e. styling the alt attribute) but you can use Javascript, CSS and a <div> or <span> tag...
Read more >
CSS Tooltip Generator
This generator will help you design and create CSS tooltips for your website. ... This code generator does not cover all the style...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found