jacerider / neo_tooltip
Provide tooltip API for elements and fields.
Installs: 330
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:drupal-module
pkg:composer/jacerider/neo_tooltip
Requires
- drupal/core: ^10.3 || ^11
- jacerider/neo: ^1
- jacerider/neo_favicon: ^1
- dev-develop
- 1.0.42
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2025-11-04 20:08:28 UTC
README
- Introduction
- Requirements
- Installation
- Usage within TWIG
- Usage within PHP
- Options
INTRODUCTION
Provide tooltip API for elements and fields. It uses the Tippy.js library.
https://atomiks.github.io/tippyjs/v6/getting-started/
REQUIREMENTS
This module requires no modules outside of Drupal core.
INSTALLATION
Install as you would normally install a contributed Drupal module. Visit https://www.drupal.org/node/1897420 for further information.
USAGE WITHIN TWIG
Simple text:
<a{{ attributes.addClass(classes)|neo_tooltip_trigger }}> Your content. {{ 'Tooltip content'|neo_tooltip_content }} </a>
Build array:
<a{{ attributes.addClass(classes)|neo_tooltip_trigger({theme: 'badge', placement: 'right', animation: 'shift-toward'}) }}> Your content. {{ content|neo_tooltip_content }} </a>
USAGE WITHIN PHP
// Link element. $build['link'] = [ '#type' => 'link', '#title' => $this->t('Tooltip trigger'), '#url' => Url::fromRoute('<front>'), ]; $content = 'Tooltip content'; $tooltip = new Drupal\neo_tooltip\Tooltip($content); $tooltip ->setAnimationToShiftAway() ->setPlacementToBottomStart() ->setArrow(FALSE) ->setTrigger('focusin'); $tooltip->applyTo($build['link']); // Markup element. $build['markup'] = [ '#markup' => '<p>' . $this->t('This is a markup tooltip.') . '</p>', ]; $tooltip = new Tooltip('Tooltip content'); $tooltip->applyTo($build['markup']);
You can also use the use a helper trait in a class.
use Drupal\neo_tooltip\TooltipTrait; // Trigger will be a string or renderable element. $this->tooltip('Trigger', [ '#markup' => 'Content', ], [ 'placement' => 'top-start', ]); // Trigger will be a link. $this->tooltipAsLink('Trigger', [ '#markup' => 'Content', ], [ 'placement' => 'top-start', ])
OPTIONS
animation
{ // default trigger: 'fade', // others trigger: false, trigger: 'shift-away', trigger: 'shift-toward', trigger: 'scale', trigger: 'perspective', }
trigger
{ // default trigger: 'mouseenter focus', // others: trigger: 'click', trigger: 'focusin', trigger: 'mouseenter click', // only programmatically trigger it trigger: 'manual', }
placement
{ // default placement: 'top', // full list: placement: 'top-start', placement: 'top-end', placement: 'right', placement: 'right-start', placement: 'right-end', placement: 'bottom', placement: 'bottom-start', placement: 'bottom-end', placement: 'left', placement: 'left-start', placement: 'left-end', // choose the side with most space placement: 'auto', placement: 'auto-start', placement: 'auto-end', }