ComponentsFeedback
Tooltip
Small text label that appears on hover or focus to describe an element.
Default
Wrap your trigger element with Tooltip and TooltipTrigger, then place the label text in TooltipContent. A TooltipProvider must wrap all tooltips in your app.
Side Offset
Use the sideOffset prop on TooltipContent to control the distance between the trigger and the tooltip.
Installation
npx visor add tooltipThis copies two files into your project:
components/ui/tooltip/tooltip.tsx— the componentcomponents/ui/tooltip/tooltip.module.css— the styles
Usage
import {
Tooltip, TooltipContent, TooltipProvider, TooltipTrigger
} from '@/components/ui/tooltip/tooltip';
// Wrap your app with TooltipProvider once
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<button>?</button>
</TooltipTrigger>
<TooltipContent>Help text</TooltipContent>
</Tooltip>
</TooltipProvider>API Reference
TooltipProps
No props data available for “tooltip”.
Sub-components
| Component | Purpose |
|---|---|
TooltipProvider | Wraps the app to set global tooltip delay and behavior |
Tooltip | Root component managing open/close state for a single tooltip |
TooltipTrigger | Element that activates the tooltip on hover/focus |
TooltipContent | The floating label rendered in a portal |
Accessibility
- Built on
@radix-ui/react-tooltipwith automaticaria-describedbyassociations. - Tooltips appear on both hover and keyboard focus, ensuring full keyboard accessibility.
- Use tooltips for supplementary labels only — they should not contain essential information or interactive elements.