SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/tailwind-tooltips

6 Tailwind Tooltips

6 TailwindPublished 2026-10-04Free · no sign-up

Six tooltip patterns written with Tailwind utilities that appear on hover and on keyboard focus: a tip with an arrow, top, right, bottom and left placements, a form help icon, toolbar shortcut hints, a profile hover card and a click-to-open toggletip.

01. Tailwind Group Hover Tooltip

TailwindTooltip

A tooltip shown with group-hover: and group-focus-within:, so it appears for both mouse and keyboard users. The tip is linked to the button with aria-describedby and has an arrow made from a rotated square using before: utilities.

View code
<span class="group relative inline-block">
  <button aria-describedby="twtt1" class="rounded-lg border border-slate-600 bg-slate-800 px-4 py-2.5 text-sm font-semibold text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-300">Export</button>
  <span role="tooltip" id="twtt1" class="pointer-events-none absolute bottom-full left-1/2 mb-2.5 w-max max-w-[220px] -translate-x-1/2 rounded-lg bg-white px-3 py-2 text-center text-[13px] text-slate-900 opacity-0 transition group-focus-within:opacity-100 group-hover:opacity-100 before:absolute before:left-1/2 before:top-full before:h-2.5 before:w-2.5 before:-translate-x-1/2 before:-translate-y-1.5 before:rotate-45 before:bg-white">Download as a CSV file</span>
</span>

02. Tailwind Tooltip Placements

TailwindPlacement

Four buttons with tooltips on the top, right, bottom and left. The only differences between them are the position utilities, which shows how placement is just a matter of anchoring the absolutely positioned tip to a different edge.

View code
<div class="grid grid-cols-2 gap-x-28 gap-y-16 text-sm font-semibold">
  <span class="group relative"><button aria-describedby="tws2" class="rounded-lg border border-slate-300 bg-white px-4 py-2 text-slate-900">Right</button><span role="tooltip" id="tws2" class="pointer-events-none absolute left-full top-1/2 ml-2 w-max -translate-y-1/2 rounded-md bg-slate-900 px-2.5 py-1.5 text-xs font-medium text-white opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">To the right</span></span>
  <span class="group relative"><button aria-describedby="tws4" class="rounded-lg border border-slate-300 bg-white px-4 py-2 text-slate-900">Left</button><span role="tooltip" id="tws4" class="pointer-events-none absolute right-full top-1/2 mr-2 w-max -translate-y-1/2 rounded-md bg-slate-900 px-2.5 py-1.5 text-xs font-medium text-white opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">To the left</span></span>
  <span class="group relative"><button aria-describedby="tws1" class="rounded-lg border border-slate-300 bg-white px-4 py-2 text-slate-900">Top</button><span role="tooltip" id="tws1" class="pointer-events-none absolute bottom-full left-1/2 mb-2 w-max -translate-x-1/2 rounded-md bg-slate-900 px-2.5 py-1.5 text-xs font-medium text-white opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">Above</span></span>
  <span class="group relative"><button aria-describedby="tws3" class="rounded-lg border border-slate-300 bg-white px-4 py-2 text-slate-900">Bottom</button><span role="tooltip" id="tws3" class="pointer-events-none absolute left-1/2 top-full mt-2 w-max -translate-x-1/2 rounded-md bg-slate-900 px-2.5 py-1.5 text-xs font-medium text-white opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">Below</span></span>
</div>

03. Tailwind Form Help Tooltip

TailwindHelp

A small help button beside a form label that explains the field on hover and focus. The trigger is a real button with an accessible question as its name, which works with keyboards and on touch screens where hover does not exist.

View code
<div class="w-full max-w-xs text-sm">
  <div class="mb-1.5 flex items-center gap-2"><label for="twv" class="font-semibold text-slate-700">Tax ID</label>
    <span class="group relative"><button type="button" aria-label="What is a tax ID?" aria-describedby="twv-t" class="grid h-5 w-5 place-items-center rounded-full bg-slate-200 font-serif text-xs font-bold text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-600">i</button>
    <span role="tooltip" id="twv-t" class="pointer-events-none absolute left-7 top-1/2 z-10 hidden w-56 -translate-y-1/2 rounded-lg bg-slate-900 px-3 py-2 text-xs leading-relaxed text-white group-hover:block group-focus-within:block">Only needed for business orders. You can add it later in settings.</span></span>
  </div>
  <input id="twv" placeholder="GB123456789" class="w-full rounded-lg border border-slate-300 px-3 py-2.5 outline-none focus:border-blue-600 focus:ring-2 focus:ring-blue-100">
</div>

04. Tailwind Toolbar Shortcut Tooltips

TailwindToolbar

An icon toolbar whose tooltips show the action and its keyboard shortcut. Each button has an aria-label, the tooltip is decorative and hidden from screen readers to avoid reading the name twice, and kbd elements style the keys.

View code
<div role="toolbar" aria-label="Formatting" class="flex gap-1 rounded-xl border border-slate-700 bg-slate-900 p-1.5">
  <button aria-label="Bold" class="group relative h-9 w-9 rounded-lg font-serif font-bold text-slate-100 hover:bg-slate-800 focus-visible:bg-slate-800 focus-visible:outline-none">B<span aria-hidden="true" class="pointer-events-none absolute left-1/2 top-full mt-2 flex w-max -translate-x-1/2 items-center gap-1 rounded-md bg-white px-2 py-1 font-sans text-xs font-semibold text-slate-900 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100">Bold <kbd class="rounded border border-b-2 border-slate-300 px-1 font-mono text-[11px]">Ctrl B</kbd></span></button>
  <button aria-label="Italic" class="group relative h-9 w-9 rounded-lg font-serif italic text-slate-100 hover:bg-slate-800 focus-visible:bg-slate-800 focus-visible:outline-none">I<span aria-hidden="true" class="pointer-events-none absolute left-1/2 top-full mt-2 flex w-max -translate-x-1/2 items-center gap-1 rounded-md bg-white px-2 py-1 font-sans text-xs not-italic font-semibold text-slate-900 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100">Italic <kbd class="rounded border border-b-2 border-slate-300 px-1 font-mono text-[11px]">Ctrl I</kbd></span></button>
  <button aria-label="Strikethrough" class="group relative h-9 w-9 rounded-lg font-serif text-slate-100 line-through hover:bg-slate-800 focus-visible:bg-slate-800 focus-visible:outline-none">S<span aria-hidden="true" class="pointer-events-none absolute left-1/2 top-full mt-2 flex w-max -translate-x-1/2 items-center gap-1 rounded-md bg-white px-2 py-1 font-sans text-xs font-semibold text-slate-900 no-underline opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100">Strike <kbd class="rounded border border-b-2 border-slate-300 px-1 font-mono text-[11px]">Ctrl Shift X</kbd></span></button>
</div>

05. Tailwind Profile Hover Card

TailwindCard

A rich hover card for a username link that previews an avatar, name and short bio. delay-300 on the visible state stops it flashing when the pointer only passes over, and group-focus-within: makes it available to keyboard users.

View code
<p class="relative text-base text-slate-300">Shot by <span class="group"><a href="#" aria-describedby="twhc" class="font-bold text-sky-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-300">@dune.photo</a>
  <span role="tooltip" id="twhc" class="invisible absolute left-0 top-full z-10 mt-2.5 grid w-64 max-w-full grid-cols-[44px_1fr] gap-x-3 gap-y-0.5 rounded-2xl border border-slate-700 bg-slate-900 p-4 opacity-0 shadow-2xl transition delay-0 group-hover:visible group-hover:opacity-100 group-hover:delay-300 group-focus-within:visible group-focus-within:opacity-100">
    <span class="row-span-2 grid h-11 w-11 place-items-center rounded-full bg-gradient-to-br from-amber-400 to-pink-500 font-extrabold text-white" aria-hidden="true">D</span>
    <b class="text-white">Dana Reyes</b>
    <span class="text-[13px] leading-snug text-slate-400">Desert and coastline photographer. 12k followers.</span>
  </span></span></p>

06. Tailwind Popover Toggletip

TailwindPopover

A click-to-open info bubble using the HTML popover attribute and popovertarget, styled with Tailwind. The browser handles opening, light dismiss and Escape, and the popover is positioned near the centre of the screen as a safe default.

View code
<div class="flex items-center gap-2 text-[15px] text-slate-900">
  <span>Returns accepted within 30 days</span>
  <button popovertarget="twpop" aria-label="About returns" class="grid h-6 w-6 place-items-center rounded-full bg-slate-900 text-xs font-bold text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600">?</button>
  <div id="twpop" popover class="w-64 rounded-xl bg-slate-900 p-4 text-[13px] leading-relaxed text-white shadow-xl">Items must be unused and in their original packaging. We email a prepaid label within one working day.</div>
</div>

About these Tailwind Tooltips

group-hover and group-focus-within

Put group relative on a wrapper around the trigger and the tip, then show the tip with group-hover:opacity-100 and group-focus-within:opacity-100, so keyboard users get the same help as mouse users.

Arrows with before:

The small arrow is a rotated square drawn with before: utilities and positioned at the tip's edge. Matching its background to the tooltip makes the two read as one shape.

Link the description

Give the tip role="tooltip" and an id, and point the trigger's aria-describedby at it. In the toolbar demo the tip repeats the button name, so it is hidden with aria-hidden to avoid double reading.

Delays and touch

Use delay-300 on the visible state of larger hover cards to stop flicker, and use the popover attribute for information that people on touch screens need to open with a tap.

Frequently asked questions

Do these need JavaScript?

No. All six are pure HTML and Tailwind classes.

Can I use them in Tailwind v4?

Yes. The variants used here exist in v3.4 and v4.

Is there a CSS version?

Yes, see the CSS tooltips collection.