Composant d’info-bulle
Un composant d’info-bulle de conception de matériaux réactif avec une palette de couleurs monochromatiques pour le commerce électronique, avec prise en charge du mode sombre. Pas de JavaScript, HTML et Tailwind CSS uniquement.
HTML Code
<div class="relative flex items-center justify-center bg-gray-100 dark:bg-gray-900 min-h-screen p-8">
<!-- Product Card (Example to show tooltip in context) -->
<div class="group relative w-full max-w-sm bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden transition-all duration-300 hover:shadow-xl">
<img class="w-full h-48 object-cover" src="https://picsum.photos/400/300?random=1" alt="Product Image">
<div class="p-6">
<h3 class="text-xl font-semibold text-gray-800 dark:text-gray-100 mb-2">Stylish Headphones</h3>
<p class="text-gray-600 dark:text-gray-300 text-sm mb-4">Immerse yourself in rich, clear sound with these premium headphones.</p>
<div class="flex items-center justify-between">
<span class="text-2xl font-bold text-gray-900 dark:text-gray-50">$149.99</span>
<!-- Tooltip Trigger (e.g., Add to Cart Button) -->
<button class="relative bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 text-white font-medium py-2 px-4 rounded-full transition-colors duration-300 group focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50">
Add to Cart
<!-- Tooltip Content -->
<div class="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-max px-3 py-1.5 bg-gray-800 dark:bg-gray-100 text-white dark:text-gray-900 text-sm rounded-md opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-300 pointer-events-none shadow-lg">
Add item to your shopping cart
<svg class="absolute top-full left-1/2 -translate-x-1/2 w-3 h-3 text-gray-800 dark:text-gray-100 transform rotate-180" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 0L0 10h20L10 0z"/>
</svg>
</div>
</button>
</div>
</div>
</div>
<!-- Another Tooltip Example (e.g., Info Icon) -->
<div class="group relative ml-12">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-gray-500 dark:text-gray-400 cursor-pointer transition-colors duration-300 hover:text-blue-600 dark:hover:text-blue-500" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2h1a1 1 0 001-1V9a1 1 0 00-1-1H9zm6 3a1 1 0 100 2h2a1 1 0 100-2h-2z" clip-rule="evenodd" />
</svg>
<!-- Tooltip Content -->
<div class="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-max px-3 py-1.5 bg-gray-800 dark:bg-gray-100 text-white dark:text-gray-900 text-sm rounded-md opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-300 pointer-events-none shadow-lg">
More information about the product
<svg class="absolute top-full left-1/2 -translate-x-1/2 w-3 h-3 text-gray-800 dark:text-gray-100 transform rotate-180" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 0L0 10h20L10 0z"/>
</svg>
</div>
</div>
</div>
Composants associés
Infobulle pastel minimaliste
Un composant d’info-bulle minimal et plat conçu pour les sites Web d’entreprise et d’entreprise avec des couleurs pastel, un design réactif et une prise en charge du mode sombre à l’aide de Tailwind CSS.
Infobulle minimaliste
Un composant d’info-bulle de conception minimaliste et plat pour les sites Web de blog/contenu, avec une palette de couleurs monochromatiques et une mise en page simple. Il est réactif et prend en charge le mode sombre à l’aide de Tailwind CSS.
Composant d’info-bulle
Un composant d’info-bulle réactif avec des micro-interactions pour l’engagement de l’utilisateur, avec un thème sombre et des animations attrayantes.