dLinkTooltip
This library was generated with Angular CLI version 15.1.6.
๐ง dlink-tooltip -By JBORAD988
dlink-tooltip
is a lightweight, highly customizable Angular tooltip library designed to enhance UX without relying on heavy CSS hacks. Ideal for enterprise-level applications where UI clarity and control matter.
๐งช Beta Features
-
Live Tooltip Updates
Tooltip content now updates in real-time, ensuring the latest data is always displayed.
-
Responsive Tooltip Positioning
Tooltips now dynamically adjust their position during screen zoom or scroll events for improved visibility and user experience.
๐ Live Demo
Experience the new tooltip features in action:
๐ View D-Link Tooltip Live Demo
๐ Why Use dlink-tooltip
?
Hardcoded CSS tooltips are:
- โ Difficult to maintain
- โ Not reusable
- โ Often break on responsive layouts
- โ Limited in positioning and interactivity
dLink offers:
- โ
Smart positioning to avoid clipping
- โ
Multiple trigger types (hover, click, focus, manual)
- โ
Rich content support (HTML, templates)
- โ
Built-in theme system (dark, light, custom)
- โ
Advanced animation system (fade, slide, scale)
- โ
Event callbacks and manual control(in future updates)
- โ
Accessibility features (ARIA, keyboard navigation)
- โ
Touch gesture support for mobile
- โ
Auto-hide and persistent tooltip options
- โ
Adjustable gap, size, alignment, delay, offset
- โ
Configurable animations and custom styles
- โ
No external dependencies, built natively with Angular
๐งฑ Installation (Recommended: LTS for Best Compatibility)
npm install dlink-tooltip
โ ๏ธ We recommend using a dLink LTS version to avoid dependency conflicts or bugs and ensure smoother integration.
๐ Import the Module
import { DLinkModule } from 'dlink-tooltip';
@NgModule({
imports: [ DLinkModule ]
})
export class YourModule { }
๐ Angular Compatibility
๐งช Latest Version 1.0.3(beta) tested up to Angular 15.1.6 (LTS)
โ๏ธ Tooltip Directive Usage
Basic Usage
<button dLinkTooltip="This is a tooltip">Hover me</button>
Advanced Usage
<button
dLinkTooltip="<strong>Rich HTML</strong> content"
[tooltipHtml]="true"
tooltipTheme="light"
tooltipAnimation="scale"
tooltipTrigger="click"
[tooltipPosition]="'top-right'"
[tooltipFontSize]="'14px'"
[tooltipGap]="8"
[tooltipAlign]="'left'"
[tooltipMaxWidth]="'200px'"
[tooltipClass]="'custom-tooltip'"
[tooltipSmartPosition]="true"
[tooltipSpeed]="'fast'"
[tooltipShowDelay]="200"
[tooltipHideDelay]="100"
[tooltipAutoHide]="3000"
[tooltipPersistent]="false"
[tooltipShowOnLoad]="false"
[tooltipOffset]="{x: 10, y: 5}"
[tooltipTouchGestures]="true"
tooltipAriaLabel="Additional info"
(tooltipShow)="onShow()" //Info: In future updates
(tooltipHide)="onHide()" //Info: In future updates
>
Advanced Tooltip
</button>
๐ฅ Directive Inputs / Properties
Core Properties
dLinkTooltip | string | '' | The text/content shown in the tooltip |
tooltipPosition | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top' | Tooltip placement |
tooltipTrigger | 'hover' | 'click' | 'focus' | 'hover' | How tooltip is triggered |
tooltipTheme | 'dark' | 'light' | 'custom' | 'dark' | Built-in theme or custom styling |
tooltipAnimation | 'fade' | 'slide' | 'scale' | 'none' | 'fade' | Animation type for show/hide |
tooltipSpeed | 'fast' | 'medium' | 'slow' | 'medium' | Animation speed |
Content & Styling
tooltipHtml | boolean | false | Enable HTML content rendering |
tooltipFontSize | string | '14px' | Font size of tooltip content |
tooltipMaxWidth | string | '200px' | Max width of the tooltip |
tooltipAlign | 'center' | 'left' | 'right' | 'center' | Tooltip alignment relative to element |
tooltipClass | string | '' | Custom CSS class for additional styling |
Positioning & Layout
tooltipGap | number | 8 | Distance between tooltip and element |
tooltipOffset | {x: number, y: number} | {x:0, y:0} | Additional X/Y offset for fine positioning |
tooltipSmartPosition | boolean | true | Auto-adjust if tooltip goes out of viewport |
Timing & Behavior
tooltipShowDelay | number | 0 | Delay before showing tooltip (ms) |
tooltipHideDelay | number | 0 | Delay before hiding tooltip (ms) |
tooltipAutoHide | number | 0 | Auto-hide after milliseconds (0 = disabled) |
tooltipPersistent | boolean | false | Keeps tooltip visible until manually hidden |
tooltipShowOnLoad | boolean | false | Shows tooltip as soon as component loads |
Accessibility & Touch
tooltipTouchGestures | boolean | true | Enable touch gesture support |
tooltipRole | string | 'tooltip' | ARIA role attribute |
tooltipAriaLabel | string | '' | ARIA label for accessibility |
Output Events
tooltipShow | EventEmitter<void> | Emitted when tooltip is shown |
tooltipHide | EventEmitter<void> | Emitted when tooltip is hidden |
Public Methods (In Future Updates - currently not available)
showTooltip() | Programmatically show the tooltip |
hideTooltip() | Programmatically hide the tooltip |
toggleTooltip() | Toggle tooltip visibility |
๐ฏ Feature Examples
Trigger Types
<button dLinkTooltip="Hover tooltip" tooltipTrigger="hover">Hover me</button>
<button dLinkTooltip="Click tooltip" tooltipTrigger="click">Click me</button>
<input dLinkTooltip="Focus tooltip" tooltipTrigger="focus" placeholder="Focus me">
Themes
<button dLinkTooltip="Dark theme tooltip" tooltipTheme="dark">Dark</button>
<button dLinkTooltip="Light theme tooltip" tooltipTheme="light">Light</button>
<button dLinkTooltip="Custom theme tooltip" tooltipTheme="custom" tooltipClass="my-custom-tooltip">Custom</button>
Animations
<button dLinkTooltip="Fade animation" tooltipAnimation="fade">Fade</button>
<button dLinkTooltip="Slide animation" tooltipAnimation="slide">Slide</button>
<button dLinkTooltip="Scale animation" tooltipAnimation="scale">Scale</button>
<button dLinkTooltip="No animation" tooltipAnimation="none">None</button>
HTML Content
<button dLinkTooltip="Plain text tooltip">Plain Text</button>
<button dLinkTooltip="<strong>Bold</strong> and <em>italic</em> text" [tooltipHtml]="true">HTML Content</button>
<button dLinkTooltip="<div style='color: #ff6b6b;'>๐จ Styled HTML</div><br><small>With line breaks</small>"
[tooltipHtml]="true">Rich HTML</button>
Event Handling
export class MyComponent {
onTooltipShow() {
console.log('Tooltip shown!');
}
onTooltipHide() {
console.log('Tooltip hidden!');
}
}
<button dLinkTooltip="Event tooltip"
(tooltipShow)="onTooltipShow()"
(tooltipHide)="onTooltipHide()">
Events Tooltip
</button>
Persistent & Auto-hide
<div dLinkTooltip="This tooltip stays visible!"
[tooltipPersistent]="true"
[tooltipShowOnLoad]="true"
tooltipPosition="right">
Persistent tooltip
</div>
<button dLinkTooltip="Auto-hide after 3 seconds"
[tooltipAutoHide]="3000">
Auto Hide
</button>
Positioning & Offset
<button dLinkTooltip="Top tooltip" tooltipPosition="top">Top</button>
<button dLinkTooltip="Top-left tooltip" tooltipPosition="top-left">Top-Left</button>
<button dLinkTooltip="Top-right tooltip" tooltipPosition="top-right">Top-Right</button>
<button dLinkTooltip="Bottom tooltip" tooltipPosition="bottom">Bottom</button>
<button dLinkTooltip="Bottom-left tooltip" tooltipPosition="bottom-left">Bottom-Left</button>
<button dLinkTooltip="Bottom-right tooltip" tooltipPosition="bottom-right">Bottom-Right</button>
<button dLinkTooltip="Left tooltip" tooltipPosition="left">Left</button>
<button dLinkTooltip="Right tooltip" tooltipPosition="right">Right</button>
<button dLinkTooltip="Offset tooltip" [tooltipOffset]="{x: 20, y: 10}">Offset</button>
Accessibility
<button dLinkTooltip="Accessible tooltip"
tooltipAriaLabel="Additional accessibility information"
tooltipRole="tooltip">
Accessible Tooltip
</button>
Complex Example
<button
dLinkTooltip="<div style='text-align: center;'><strong>๐ Advanced Tooltip</strong><br><em>Multiple features combined</em><br><small style='color: #888;'>HTML + Theme + Animation</small></div>"
[tooltipHtml]="true"
tooltipTheme="light"
tooltipAnimation="scale"
tooltipSpeed="slow"
tooltipPosition="top"
[tooltipShowDelay]="300"
[tooltipHideDelay]="200"
tooltipMaxWidth="250px"
[tooltipOffset]="{x: 0, y: -5}">
๐ฏ Complex Tooltip
</button>
Custom Styling
.my-custom-tooltip {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
border: 2px solid #fff !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
font-weight: 600 !important;
}
๐ Development Commands
Generate Components
ng generate component component-name --project rx-tooltip
Always use --project rx-tooltip
to scope to the library
Build the Library
ng build rx-tooltip
Publish to npm
cd dist/rx-tooltip
npm publish
Run Unit Tests
ng test rx-tooltip
๐ Additional Resources