Component

Rich Tooltip

Wide tooltip with rich content - a title plus a multi-line description - ideal for help text on form fields and complex UI elements. Pure CSS using two data attributes, hover or focus to reveal.

  • Component
  • Tailwind
  • HTML
  • MIT

What it does

Capabilities

  • Title + description content
  • Multi-line wrapping
  • Wider tooltip box
  • Hover + focus triggers
  • Shadow elevation
  • Pure CSS no JS
  • Role=tooltip
  • Aria-describedby
  • Icon trigger

Preview

Live component

Interactive preview
Open preview
9:41 100%
devsnips.site/library/tailwind/components/tooltips/rich-tooltip/
fluid · no fixed width 100%
No dependencies Production-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Tooltips/rich-tooltip
registry path: Tailwind/Components/Tooltips/rich-tooltip

Source

Implementation

code.html
<!--
Snippet Name: Rich Tooltip
Description: Wide tooltip with rich content - title, description, and an optional link. For help text on form fields or complex UI elements. Pure CSS, hover or focus to reveal.
Author: DevSnips Contributors
Usage Example: Use data-tooltip-title and data-tooltip-desc attributes. The tooltip widens to fit multi-line content.
-->
<div class="inline-flex items-center gap-1.5">
  <label for="api-key" class="text-sm font-medium text-gray-700">API key</label>
  <button
    type="button"
    class="tt-rich flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-gray-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
    data-tooltip-title="What is an API key?"
    data-tooltip-desc="A unique token that authenticates requests to our API. Find it under Settings → API. Keep it secret."
    aria-label="About API keys"
    aria-describedby="tt-rich-desc"
  >
    <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
  </button>
  <span id="tt-rich-desc" role="tooltip" class="sr-only">About API keys</span>
</div>

<style>
  .tt-rich { position: relative; }
  .tt-rich::after {
    content: attr(data-tooltip-title);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    width: 240px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #111827;
    color: #f9fafb;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    white-space: normal;
  }
  /* description sits as a second line via the ::after content trick - combine title + newline + desc */
  .tt-rich::after {
    content: attr(data-tooltip-title) "\A" attr(data-tooltip-desc);
    white-space: pre-wrap;
    font-weight: 400;
  }
  .tt-rich::after strong, .tt-rich::after b { font-weight: 600; }
  /* arrow */
  .tt-rich::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%) translateY(4px);
    border: 6px solid transparent;
    border-top-color: #111827;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
    pointer-events: none;
    z-index: 50;
  }
  .tt-rich:hover::after, .tt-rich:focus-visible::after {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
  }
  .tt-rich:hover::before, .tt-rich:focus-visible::before {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
  }
</style>
75 lines UTF-8 · LF · Spaces: 2
DevSnips AI ready Claude · Cursor · Windsurf

Agent skill & Model Context Protocol

Pass this component straight into your AI workflow. DevSnips exposes each resource as a structured, addressable registry entry, so your agent installs the real files instead of approximating them.

devsnips://components/tooltips/rich-tooltip
Prompt instruction
I want to use this DevSnips resource in production:

Page:
https://devsnips.site/library/tailwind/components/tooltips/rich-tooltip/

Install: npx devsnips add
Tailwind/Components/Tooltips/rich-tooltip

This is the Rich Tooltip — Wide tooltip with rich content - a title plus a multi-line description - ideal for help text on form fields and complex UI elements. Pure CSS using two data attributes, hover or focus to reveal.

Use this DevSnips resource as the starting point for my project.
Adapt it to my project's stack and conventions, fix any issues,
and make it production-ready while preserving its intended design
and behavior.

Paste into ChatGPT, Claude or your agent — it already carries the page URL and the exact install path.

Resource URI
devsnips://components/tooltips/rich-tooltip