tooltip Component
Tooltip Class API Reference
| Type | Class/Attribute Options | Usage | Notes |
|---|---|---|---|
| Size | tiny / xs |
Extra small tooltip | 10px font, minimal padding |
small |
Small tooltip | 12px font, compact | |
| (default) | Medium tooltip | 14px font, standard | |
large |
Large tooltip with rich content | Supports title, description, icon | |
big / xl |
Extra large tooltip | 16px font, max content | |
| Position | top |
Above element, centered | Default position |
top-start |
Above element, aligned to start | Arrow on left | |
top-end |
Above element, aligned to end | Arrow on right | |
bottom |
Below element, centered | Common alternative | |
bottom-start |
Below element, aligned to start | Arrow on left | |
bottom-end |
Below element, aligned to end | Arrow on right | |
left |
Left of element, centered | For side tooltips | |
left-start |
Left of element, aligned to top | Arrow at top | |
left-end |
Left of element, aligned to bottom | Arrow at bottom | |
right |
Right of element, centered | For side tooltips | |
right-start |
Right of element, aligned to top | Arrow at top | |
right-end |
Right of element, aligned to bottom | Arrow at bottom | |
| Theme/Color | (default) | Light theme | White background |
dark |
Dark theme | Dark background | |
primary |
Primary brand color | Blue theme | |
positive / success |
Success state | Green theme | |
negative / error |
Error state | Red theme | |
warning |
Warning state | Yellow theme | |
info |
Information | Blue theme | |
| Trigger | hover |
Show on mouse hover | Default trigger |
click |
Show on click | Sticky tooltip | |
focus |
Show on focus | For form elements | |
hover-focus |
Show on hover or focus | Best accessibility | |
manual |
Programmatic control | Via JavaScript | |
| Animation | fade |
Fade in/out | Default animation |
scale |
Scale in/out | Zoom effect | |
slide |
Slide from position | Directional slide |
Basic Usage
Simple tooltips with data attributes. Hover over the elements to see tooltips.
Default Tooltip
Preview
Code
Hover this link
Hover this text
Different Sizes
Preview
Code
Positioning
Tooltips can be positioned in 12 different locations around the target element.
Cardinal Positions
Preview
Code
Advanced Positions
Preview
Code
Color Themes
Apply different color themes to match your UI's context and state.
Theme Variations
Preview
Code
Trigger Types
Control how tooltips are triggered based on user interaction.
Different Triggers
Preview
Code
Rich Content Tooltips
Large tooltips with icons, titles, descriptions, and actions.
Complex Tooltip Structure
Preview
Code
HTML Content
Preview
Code
Timing Controls
Control show/hide delays for better UX.
Delay Options
Preview
Code
Animations
Different animation styles for tooltip appearance.
Animation Types
Preview
Code
Accessibility Features
Tooltips include ARIA attributes and keyboard support.
Accessible Tooltips
Preview
Code
- All tooltips have
role="tooltip"and proper ARIA attributes - Press Escape to close any visible tooltip
- Focus triggers work for keyboard navigation
- Animations respect
prefers-reduced-motionmedia query - Mobile support with long-press gesture
Utility Options
Additional utility classes and options.
Max Width Control
Preview
Code
No Arrow Option
Preview
Code
JavaScript API
Programmatic control via hygge.on.tooltip methods.
Manual Control
Preview
Code
// Show tooltip
hygge.on.tooltip.show(element, options);
// Hide tooltip
hygge.on.tooltip.hide(element);
// Toggle tooltip
hygge.on.tooltip.toggle(element);
// Update content
hygge.on.tooltip.update(element, {
text: 'New content',
title: 'New title'
});
// Hide all tooltips
hygge.on.tooltip.hideAll();
Dynamic Updates
Preview
Code
Complex Examples
Real-world tooltip implementations.
Form Validation Helper
Preview
Code
Icon Buttons with Tooltips
Preview
Code
Table with Cell Tooltips
Preview
Code
| Feature | Status | Info |
|---|---|---|
| Auto-positioning | Active | ℹ️ |
| Mobile Support | Active | ℹ️ |
| Accessibility | Active | ℹ️ |