Base · Overlays
Tooltip
A short text label that appears when a control is hovered or focused.
HTML / JSPlannedReactStableReact NativeDraftSwift (SwiftUI)PlannedGodotPlannedVueDraftSvelteDraftSolidDraft
Reviewed
Props
tsx
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { DownloadIcon } from "lucide-react"
<Tooltip>
<TooltipTrigger render={<Button variant="outline" size="icon" aria-label="Download manifest" />}>
<DownloadIcon />
</TooltipTrigger>
<TooltipContent>Download manifest</TooltipContent>
</Tooltip>Overview
A tooltip names or briefly explains the control it is attached to. It holds plain text only, appears on hover and keyboard focus, and disappears as soon as the pointer or focus leaves.
When to use
- To name an icon-only button, such as “Download manifest”.
- To show a keyboard shortcut next to the name of an action.
- To reveal a value that is truncated in a table cell or tab.
When not to use
- For information the user needs in order to complete a task: put it on the page, since tooltips are not available on touch screens.
- For content with links, buttons or formatting: use a Popover.
- To preview a person, account or link: use a Hover card.
- To explain a form field: use the field's description text.
Anatomy
Trigger
The control being described. It must be focusable.
Content
An inverse-colored label, at most 20rem wide.
Arrow
Points from the label to the trigger.
Props
The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).
| Prop | Type | Default | Description |
|---|---|---|---|
| side | "top" | "bottom" | "left" | "right" | top | The side of the trigger the tooltip appears on. Set on TooltipContent. |
| align | "center" | "start" | "end" | center | How the tooltip lines up with the trigger along that side. |
| label | string | Download manifest | The tooltip text. Passed as children of TooltipContent. |
| sideOffset | number | 4 | Gap between the trigger and the tooltip, in pixels. |
States
- Hidden
- Default. Nothing is rendered.
- Visible
- Shown while the trigger is hovered or has keyboard focus. Fades and scales in.
- Instant
- When moving between neighboring triggers, the next tooltip appears without delay or animation.
Accessibility
Role: tooltip
| Keys | Action |
|---|---|
| Tab | Focusing the trigger shows the tooltip; moving focus away hides it. |
| Escape | Hides the tooltip while keeping focus on the trigger. |
- The tooltip is not announced as the control's name. Icon-only triggers still need an aria-label.
- Tooltips do not appear on touch devices, so never rely on one for essential information.
- Keep the text to a few words. It cannot receive focus, so it must not contain interactive content.
Design tokens
Change any of these in Foundations and this component follows, in every language.
Platform notes
- HTML / JS
- Planned
- Not built in HTML / JS yet.
- React
- Stable
- Matches the contract with no platform differences.
- React Native
- Draft
- Wraps one pressable child: shows on long-press and hides shortly after the finger lifts, and on hover and keyboard focus on web. The label also becomes the trigger's accessible name.
- Swift (SwiftUI)
- Planned
- Not built in Swift yet.
- Godot
- Planned
- Not built in Godot yet.
- Vue
- Draft
- Usage snippet only; the trigger wraps the button with `as-child`.
- Svelte
- Draft
- Usage snippet only; the trigger uses a `child` snippet to render the button.
- Solid
- Draft
- Usage snippet only; the trigger renders the button through its `as` prop.