npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nemex-angular2-tooltip

v1.1.3

Published

Advanced angular 2 tooltip

Downloads

110

Readme

Advanced Angular 2 Tooltip

This package allows you to create highly customizable or simple tooltips easily. It supports adding HTML content such as buttons just like Facebook user profile tooltip, or you can just use it as a simple tooltip.

It features the following:

  • Control of tooltip placements.
  • Tooltip with HTML content support! (including buttons)
  • Global and specific styling for each tooltip.
  • Advanced configurations.
  • Easy to use yet highly configurable and customizable.

It looks like the following (by default):

Angular2 tooltip example

It comes with an example code containg the following: Angular2 tooltip example

Tooltip installation

Install the package using the following command:

npm install nemex-angular2-tooltip --save

In your app module add the following code:

...
import { NemexTooltipModule, TooltipService } from 'nemex-angular2-tooltip';

@NgModule({
  ...
  // Import the module in order to add the tooltip directive
  imports: [
    ...
    NemexTooltipModule
  ],
  // Add the tooltip service to your list of providers in order to easily configure it globally
  providers: [ 
    ...
    TooltipService
  ],
  ...
})

Now to your component html add the following:

<div tooltip tooltipContent="I'm a nice tooltip!">
    ...
</div>

If you want to use HTML inside of your tooltip, use the following:

<div tooltip>
    <div class="tooltip-content">
        <!-- Any custom content goes here -->
        <button>Just a simple tooltip button!</button>
    </div>
    ...
</div>

Advanced features

The tooltip can be customized using simple properties such as:

<!-- Creates a tooltip positioned to the right of the element -->
<div tooltip tooltipContent="Hello there!" tooltipPlacement="right">
    ...
</div>

This tooltip supports the following properties:

  • tooltipContent - the content string to show in the tooltip. If you want to render out HTML, simply add a tag inside of your HTML element with the class "tooltip-content".
  • tooltipPlacement - the position to place the tooltip relative to the element.
  • tooltipOffsetX, tooltipOffsetY - the number of pixels to add between the element to the tooltip.
  • tooltipColor - the default color of the container tooltip.
  • tooltipShowArrow - If set to false, no arrow will be shown next to tooltip.
  • tooltipLeaveRadius - the radius the mouse is allowed to leave out of the element and the tooltip still visible.
  • tooltipStyle - the style to use for the tooltip.
  • tooltipHtml - the container html for the tooltip.

Editing the default configurations

You can edit the default tooltip configurations easily, by simply accessing the TooltipService and editing the following members:

  • defaultPlacement - the default placement of the tooltip (top, bottom, left, right).
  • defaultOffset - the default number of pixels the tooltip is far from the element.
  • defaultTooltipColor - the default color of the container tooltip.
  • defaultTooltipShowArrow - By default, sets if the tooltip arrow will be shown or not (set to true).
  • defaultMouseLeaveRadius - the default radius the mouse is allowed to leave out of the leement and the tooltip still visible.
  • defaultTooltipStyle - the default style the tooltip.
  • defaultTooltipHtml - the default tooltip container html. You must specify a tag with the "tooltip-container" for the tooltip to populate the content into.

An example of editing the default tooltip style is by injecting the service into the app component:

import { Component } from '@angular/core';
import { TooltipService } from 'nemex-angular2-tooltip';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';

  public constructor(private tooltipService:TooltipService) {
    tooltipService.defaultTooltipStyle =
      `background: #000;
       color: #fff;
       padding: 5px;`;
  }
}