{% extends 'base.html.twig' %} {% block title %}Tooltip - Design System - Bubul{% endblock %} {% block body %}
{# ===== HEADER ===== #}
Atomes /

Tooltip

Info-bulle CSS-only au survol

{# ===== USAGE ===== #}

Usage

{% verbatim %}{% embed '_atoms/tooltip/tooltip.html.twig' with {
    text: 'Texte du tooltip',
    position: 'top'
} %}
    {% block content %}
        
    {% endblock %}
{% endembed %}{% endverbatim %}

Fichier : templates/_atoms/tooltip/tooltip.html.twig

Note : Utilise embed pour permettre le slot de contenu personnalisé.

{# ===== EXEMPLE DE BASE ===== #}

Exemple de base

{% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Ceci est un tooltip' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Aide contextuelle' } %} {% block content %} Qu'est-ce que c'est ? {% endblock %} {% endembed %}
{# ===== POSITIONS ===== #}

Positions

Paramètre : position

{% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Position top', position: 'top' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Position bottom', position: 'bottom' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Position left', position: 'left' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Position right', position: 'right' } %} {% block content %} {% endblock %} {% endembed %}
{# ===== VARIANTES ===== #}

Variantes de style

Paramètre : variant

{% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Tooltip sombre', variant: 'dark' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Tooltip clair', variant: 'light' } %} {% block content %} {% endblock %} {% endembed %}
{# ===== TAILLES ===== #}

Tailles

Paramètre : size

{% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Petit tooltip', size: 'sm' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Tooltip moyen', size: 'md' } %} {% block content %} {% endblock %} {% endembed %}
{# ===== EXEMPLES D'UTILISATION ===== #}

Exemples d'utilisation

{# Barre d'outils #}

Barre d'outils avec icônes :

{% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Enregistrer', position: 'bottom' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Modifier', position: 'bottom' } %} {% block content %} {% endblock %} {% endembed %} {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Supprimer', position: 'bottom' } %} {% block content %} {% endblock %} {% endembed %}
{# Texte avec aide #}

Texte avec aide contextuelle :

Le {% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Représentation graphique d\'un utilisateur', variant: 'light' } %} {% block content %} avatar {% endblock %} {% endembed %} s'affiche à côté du nom.

{# Badge avec info #}

Badge avec information :

{% embed '_atoms/tooltip/tooltip.html.twig' with { text: 'Cette fonctionnalité est en cours de développement', position: 'right' } %} {% block content %} Beta {% endblock %} {% endembed %}
{# ===== ACCESSIBILITÉ ===== #}

Accessibilité

  • Attribut role="tooltip" pour les lecteurs d'écran
  • Visible au focus (navigation clavier) via group-focus-within
  • Contraste suffisant entre le texte et le fond
  • Pas de JavaScript requis (CSS-only)
{# ===== PARAMÈTRES ===== #}

Paramètres

Paramètre Type Défaut Description
textstring''Texte affiché dans le tooltip
positionstringtoptop, bottom, left, right
variantstringdarkdark, light
sizestringmdsm, md
classstring''Classes additionnelles sur le conteneur
{% endblock %}