All Projects → drozhzhin-n-e → ng2-tooltip-directive

drozhzhin-n-e / ng2-tooltip-directive

Licence: MIT license
The tooltip is a pop-up tip that appears when you hover over an item or click on it.

Programming Languages

typescript
32286 projects
Sass
350 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ng2-tooltip-directive

Ngx Scroll To
Scroll to any element to enhance scroll-based features in you app. Works for Angular 4+, both AoT and SSR. No dependencies.
Stars: ✭ 269 (+166.34%)
Mutual labels:  angular2, ngx
Ngx Echarts
An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
Stars: ✭ 820 (+711.88%)
Mutual labels:  angular2, ngx
Ngx Cookie Service
Angular (4.2+ ...11) service for cookies. Originally based on the `ng2-cookies` library.
Stars: ✭ 363 (+259.41%)
Mutual labels:  angular2, ngx
awesome-angular
💖 A list of awesome Angular (2️⃣➕) resources
Stars: ✭ 61 (-39.6%)
Mutual labels:  angular2, ngx
Ngx Mqtt
This library isn't just a wrapper around MQTT.js for angular. It uses observables and takes care of subscription handling and message routing.
Stars: ✭ 157 (+55.45%)
Mutual labels:  angular2, ngx
Ngx Drag To Select
A lightweight, fast, configurable and reactive drag-to-select component for Angular 6 and beyond
Stars: ✭ 262 (+159.41%)
Mutual labels:  angular2, ngx
Ngx Dnd
🕶 Drag, Drop and Sorting Library for Angular2 and beyond!
Stars: ✭ 511 (+405.94%)
Mutual labels:  angular2, ngx
ng-elm
Write Angular components in Elm.
Stars: ✭ 41 (-59.41%)
Mutual labels:  angular2, ngx
Ngx Date Fns
⏳ date-fns pipes for Angular 2.0 and above ⏳
Stars: ✭ 135 (+33.66%)
Mutual labels:  angular2, ngx
Angulartics2
Vendor-agnostic analytics for Angular2 applications.
Stars: ✭ 963 (+853.47%)
Mutual labels:  angular2, ngx
Core
The internationalization (i18n) library for Angular
Stars: ✭ 4,027 (+3887.13%)
Mutual labels:  angular2, ngx
Ngx Popper
An angular wrapper for popper.js, great for tooltips and positioning popping elements
Stars: ✭ 183 (+81.19%)
Mutual labels:  angular2, tooltip
Angular2 Carousel
An lightweight , touchable and responsive library to create a carousel for angular 2 / 4 / 5
Stars: ✭ 26 (-74.26%)
Mutual labels:  angular2, ngx
Ngx Daterangepicker Material
Pure Angular 2+ date range picker with material design theme, a demo here:
Stars: ✭ 169 (+67.33%)
Mutual labels:  angular2, ngx
Ngx File Drop
Angular 11 file and folder drop library
Stars: ✭ 220 (+117.82%)
Mutual labels:  angular2, ngx
ngx-json-ld
📝 A small component to easily bind JSON-LD schema to Angular templates.
Stars: ✭ 29 (-71.29%)
Mutual labels:  angular2
react-sticky-mouse-tooltip
React tooltip component that follow mouse cursor.
Stars: ✭ 17 (-83.17%)
Mutual labels:  tooltip
angular2-webpack-advance-starter
An advanced Angular2 Webpack Starter project with support for ngrx/store, ngrx/effects, ng2-translate, angulartics2, lodash, NativeScript (*native* mobile), Electron (Mac, Windows and Linux desktop) and more.
Stars: ✭ 49 (-51.49%)
Mutual labels:  angular2
ngx-widget-grid
Angular 2.x or in general ng-x module for dashboards
Stars: ✭ 65 (-35.64%)
Mutual labels:  angular2
angular-for-beginners-starter
A beginner friendly playground for Getting Started with Angular, by the Angular University
Stars: ✭ 52 (-48.51%)
Mutual labels:  angular2

Tooltip for Angular

Build Status

The tooltip is a pop-up tip that appears when you hover over an item or click on it.

🔬️ Help make Tooltips better by answering a few questions.

Demo

http://ivylab.space/tooltip

Installation

Install the npm package.

npm i ng2-tooltip-directive

Import Ng2Module:

import { TooltipModule } from 'ng2-tooltip-directive';
 
@NgModule({
    imports: [ TooltipModule ]
}) 

Usage

Options can be set in the directive tag, so they have the highest priority.

<span tooltip="Tooltip" placement="top" showDelay="500">Tooltip on top</span>

You may pass as an object:

<span tooltip="Tooltip" [options]="myOptions">Tooltip on left</span>
myOptions = {
    'placement': 'left',
    'showDelay': 500
}

You can pass HTML as content :

<span tooltip="<p>Hello i'm a <strong>bold</strong> text!</p>">
  Tooltip with HTML content
</span>
<ng-template #HtmlContent>
  <p>Hello i'm a <strong>bold</strong> text!</p>
</ng-template>

<span [tooltip]="HtmlContent" contentType="template">
  Tooltip with template content
</span>

Set default values

Create a file with your settings, for example:

import { TooltipOptions } from 'ng2-tooltip-directive';

export const MyDefaultTooltipOptions: TooltipOptions = {
  'show-delay': 500
}

And pass your parameters when importing the module:

import { TooltipModule, TooltipOptions } from 'ng2-tooltip-directive';
import { MyDefaultTooltipOptions } from './my-default-options';
 
@NgModule({
    imports: [ 
      TooltipModule.forRoot(MyDefaultTooltipOptions as TooltipOptions)
    ]
})

Properties

name type default description
placement "top", "bottom", "left", "right" "top" The position of the tooltip.
autoPlacement boolean true Place the tooltip so that it does not go beyond the borders of the browser window.
showDelay number 0 The delay in ms before showing the tooltip.
hideDelay number 300 The delay in ms before removing the tooltip.
hideDelayTouchscreen number 0 Delay in milliseconds before hiding the tooltip (for mobile devices).
display boolean true Tooltip availability for display.
displayTouchscreen boolean true Display the tooltip on mobile devices.
zIndex number 0 Z-index of the tooltip.
trigger "hover", "click" "hover" Specifies how the tooltip is triggered. Control the closing time with "hide-delay".
tooltipClass string Classes to be passed to the tooltip.
animationDuration number 300 The duration controls how long the animation takes to run from start to finish.
theme "dark", "light" "dark" Theme of tooltip background and text.
shadow boolean true Shadow of the tooltip.
offset number 8 Offset the tooltip relative to the item.
width number undefined Width of the tooltip.
maxWidth number 200 Maximum width of the tooltip.
contentType "string", "html', "template" "string" The content type passed to the tooltip.
hideDelayAfterClick number 2000 Tooltip hiding delay for "click" trigger.
pointerEvents "auto", "none" "none" Defines whether or not an element reacts to pointer events.
position {top: number, left: number} undefined The tooltip coordinates relative to the browser window.

Events

When you call events, the delays that are specified in the options in the directive are taken into account. Default delay before tooltip hiding is 300 milliseconds.

Event Description
{type: "show", position: DOMRect} The event is called before the tooltip appears.
{type: "shown", position: DOMRect} The event is called after the animation of the appearance of the tooltip.
{type: "hide", position: DOMRect} The event is called before the tooltip is hidden.
{type: "hidden", position: DOMRect} The event is called after the animation of the tooltip is hidden.

Methods

If you specified the directive options, they will be taken into account when calling methods. Including the delay before the appearance and hiding of the tooltip.

Method Description
show() Shows the tooltip
hide() Hides the tooltip

Author services

Are you interested in this library but lacks features? Write to the author, he can do it for you.

Sponsors

We use Browserstack for cross-browser testing.

Browserstack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].