Skip to content

Overlays

Tooltip

Also calledhover hinthelp tip

A short, non-interactive hint shown beside a control on hover or keyboard focus.

How people describe it

  • “small text label that appears when I hover”
  • “tiny explanation beside an icon”
  • “hint that appears when a button gets focus”

Good for

  • Explaining an unfamiliar action
  • Providing optional context for a control

Don’t mix it up with

  • Can contain richer content and interactive controls; a tooltip contains only a short hint.

What your library calls it

LIBRARYCALLS IT
shadcn/uiTooltip

Accessibility checklist

  • Show on keyboard focus as well as hover
  • Allow Escape dismissal and hovering over the hint
  • Keep essential information visible and omit interactive content

Try it

Hover or Tab to the button. Press Escape to dismiss.

Prompt

Add a tooltip on hover and keyboard focus. Dismiss it with Escape.

~17 estimated prompt tokensDetailed: ~64 estimated prompt tokens

Rough estimate for prompt text only; actual counts vary by model and context.

"use client";
// Requires the shadcn/ui tooltip component in the consuming project.
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";

export function SaveHint({ onSave }: { onSave: () => void }) {
  return (
    <TooltipProvider>
      <Tooltip>
        <TooltipTrigger type="button" onClick={onSave} className="min-h-11 min-w-11 px-4 focus-visible:outline-2 focus-visible:outline-offset-2">Save</TooltipTrigger>
        <TooltipContent>Store your changes for later.</TooltipContent>
      </Tooltip>
    </TooltipProvider>
  );
}