Tooltip
A small popup that shows a short hint when a user hovers or keyboard-focuses an element. It is built on Base UI's Tooltip primitive and exposes Provider, Root, Trigger, and Content parts with an optional asChild mode.


Installed with shadcn add · 2 workarounds · theme from registry.json
- applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
- installed base item https://blode.co/ui/r/ui.json (registry preview settings)
Installation
Requires @blode in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"<TooltipProvider> <Tooltip> <TooltipTrigger asChild> <button type="button">Save</button> </TooltipTrigger> <TooltipContent>Save changes (⌘S)</TooltipContent> </Tooltip></TooltipProvider>- Adding a short text label or hint to an icon-only button, such as 'Copy' or 'Delete'.
- Explaining an abbreviation, keyboard shortcut, or disabled control on hover or focus.
- Showing supplementary information that is not required to complete the task.
- Wrapping many triggers in one TooltipProvider so they share delay behavior.
Examples
Icon-only button with a label
Uses asChild so the Button itself is the trigger and receives focus and hover.
import { Button } from "@/components/ui/button"import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"import { Trash2 } from "lucide-react"export function DeleteButton() { return ( <TooltipProvider> <Tooltip> <TooltipTrigger asChild> <Button variant="ghost" size="icon" aria-label="Delete item"> <Trash2 /> </Button> </TooltipTrigger> <TooltipContent>Delete item</TooltipContent> </Tooltip> </TooltipProvider> )}Placing the content on the right side
Sets side and sideOffset on TooltipContent to position the popup to the right of the trigger.
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"export function HelpHint() { return ( <TooltipProvider delayDuration={300}> <Tooltip> <TooltipTrigger>?</TooltipTrigger> <TooltipContent side="right" sideOffset={12}> Press ? to see all shortcuts </TooltipContent> </Tooltip> </TooltipProvider> )}Tooltip on a disabled-looking control
Wraps a span-based trigger so the hint is still reachable by hover and focus.
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"export function ExportNote() { return ( <TooltipProvider> <Tooltip> <TooltipTrigger asChild> <span tabIndex={0} className="cursor-not-allowed opacity-50">Export</span> </TooltipTrigger> <TooltipContent align="start">Available on the Pro plan</TooltipContent> </Tooltip> </TooltipProvider> )}API reference
Accessibility
- Base UI opens the tooltip on hover and on keyboard focus of the trigger, so the trigger must be focusable (a native button or link, or tabIndex on a span).
- Use asChild with a native interactive element so that focus and keyboard behavior come from that element rather than a wrapper.
- Give icon-only triggers an aria-label. Tooltip text supplements an accessible name and does not replace it.
- Do not put essential or interactive content inside a tooltip; users may not be able to reach it reliably.
- The popup uses motion-reduce:animate-none, so enter and exit animations are removed for users who prefer reduced motion.
- Keep text short and readable; the default text-sm on bg-primary is designed for contrast with primary-foreground.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Tooltip" component (blode/tooltip) from its shadcn registry.1. Install it with: npx shadcn@latest add @blode/tooltip2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: TooltipProvider › delayDuration, TooltipProvider › delay, Tooltip (Root), TooltipTrigger › asChild, TooltipTrigger › children, TooltipContent › side, TooltipContent › sideOffset, TooltipContent › align, TooltipContent › alignOffset, TooltipContent › asChild, TooltipContent › className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"<TooltipProvider> <Tooltip> <TooltipTrigger asChild> <button type="button">Save</button> </TooltipTrigger> <TooltipContent>Save changes (⌘S)</TooltipContent> </Tooltip></TooltipProvider>```Files & dependencies
- ui/tooltip.tsx