Tooltip
Hover/focus restatement. Never the only home of a fact.
npx shadcn add @lopifi/tooltipHow it behaves
What it renders, what it refuses to render, and why. The same paragraphs as the family spec, so the two can’t disagree.
A restatement of something already on screen. Never the only home of a fact.
<Tooltip content="30 Sep 2026, 09:12 UTC">
<time>2m ago</time>
</Tooltip>
<TooltipProvider delay={400}>{/* a toolbar, a table, an app */}</TooltipProvider>
interface TooltipProps {
/** Nullable on purpose: a truncated cell has one, a short cell does not. */
content: React.ReactNode;
children: React.ReactNode;
side?: "top" | "bottom" | "left" | "right";
align?: "start" | "center" | "end";
/** Overrides the provider's delay for this one trigger. */
delay?: number;
disabled?: boolean;
/** `block` for a child that fills its column — a truncating cell. */
display?: "inline" | "block";
triggerClassName?: string;
}
It renders its own trigger span and puts children inside it instead of cloning the
caller's element. A Server Component passes its JSX children across the boundary as a lazy
node, not an element (isValidElement is false and type is undefined), so a
render={children} clone renders undefined and crashes the page. Rendering the child as a child
works from either side of the boundary. It costs one <span>; display="block" lets a truncating
child keep its width.
What may go in one. The full figure behind $1.2M, the absolute timestamp behind "2m ago",
the untruncated merchant name behind an ellipsis, the rate and instant behind a ≈ conversion, or
the comparison basis behind a delta on a card too narrow to show it inline. A tooltip restates; it
never introduces.
What may not. Anything a user must read to act. Tooltips don't exist on touch, so a phone
user never sees a sentence that lives only in one. If it's essential, inline it. If it's extra, put
it in an InfoTip, which opens on press.
Layer 3 — structure: radius 8, --surface-raised, hairline + --elevation-2, 12px caption,
max-width 264px, 8px from its anchor.
Motion: enter opacity 0→1, scale 0.97→1 over 140ms --ease-out; exit opacity over 100ms;
400ms delay before the first one. Once one is open, hovering a neighbor opens it instantly.
Base UI sets data-instant, and the transition duration must drop to 0ms with it or the
"instant" tooltip still fades. Wrap a dense surface in TooltipProvider to get that grouping.
Accessibility: the trigger keeps its own accessible name; the tooltip is aria-describedby.
It opens on keyboard focus, closes on Escape, and is never the target of a click.
The accounting it encodes
The concepts this component renders, each defined once in the lexicon.
More in Primitives
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section Tooltip renders in, the calculators behind its figures, and the ledger payloads that feed it.
Components are copied into your repository and meant to be edited. Rounding policy, fiscal calendar and compliance copy differ per company.
Release notes
Get an email when Primitives changes
Your copy doesn’t update itself when we fix something here.
- One email when a Primitives component needs a migration
- Nothing when nothing changes
Or install it now