Design system / Molecules
Molecule / Field help
Tooltip
Tooltip associates supplementary text with a hoverable or focusable trigger. Radix owns timing, positioning and disclosure; the caller supplies the accessible trigger and explanatory content.
Live example
Current component with fictional data. Example changes are not persisted.
Responsibility
Trigger and supplementary content form one help contract. Radix coordinates hover, focus and portaled positioning. Keep required instructions visible; the tooltip must not be the only source of essential field guidance.
Public contract
The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.
| Prop / part | Type | Requirement | Responsibility |
|---|---|---|---|
| delayDuration | number | Provider · default 0 | Local default overrides upstream timing assumptions. |
| open / defaultOpen / onOpenChange | Radix Root props | Optional | Controlled or primitive-owned disclosure. |
| sideOffset | number | Content · default 0 | Placement offset; other primitive positioning props pass through. |
| asChild / children | Radix Trigger props | Assembly | Use a correctly labeled focusable trigger. |
API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.
State and behavior
Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.
Radix handles hover/focus timing and disclosure. The consumer owns help content; this wrapper neither validates fields nor loads explanations.
Dependencies
- Radix Tooltip Provider, Root, Trigger, Portal, Content and Arrow
- cn()
Token and styling contract
These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.
bg-foreground / text-background- Content contrast roles.
text-xs / max sizing from consumer- Compact source text; consumers may constrain width.
z-50 / rounded-md / px-3 / py-1.5- Portaled geometry; source state animation classes.
Boundaries and limitations
- Do not put required instructions or essential errors only in a tooltip.
- Interactive content needs a different container, such as Popover.
Where to make a change
Change shared help presentation in tooltip.tsx, field-specific copy in consumers, and trigger semantics where triggers are assembled. Preserve focus behavior and portal positioning.
Selected real uses
LabelWithInfo
Uses a zero-delay provider, a ghost/icon-xs Button named More info, and help content constrained to max-w-xs.
src/components/ui/field-label.tsxThese traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.
Usage contract
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
<TooltipProvider><Tooltip>
<TooltipTrigger asChild><button type="button">Explain scope</button></TooltipTrigger>
<TooltipContent>Scope controls the edition’s coverage.</TooltipContent>
</Tooltip></TooltipProvider>Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.