Build · New
Tooltip
Explains an icon or a term in a few words when people hover it or focus it with the keyboard.
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
SoonInstalling from the registry opens at launch. Until then the command below is what it will be.
npx shadcn@latest add @ritla/tooltipDependencies it brings: @base-ui/react, @phosphor-icons/react
Usage
import { DefinitionTooltip, IconTooltip, Tooltip } from "@/components/ui/tooltip";<IconTooltip content="Fees apply to international transfers." />
<DefinitionTooltip content="International bank account number">IBAN</DefinitionTooltip>
<Tooltip content="Copy IBAN"><IconButton icon={CopyIcon} label="Copy IBAN" /></Tooltip>Examples
Position and arrow
side top, bottom, inline start or inline end (mirrors in Arabic), align start or end, and arrow={false} for no arrow.
Toolbar
Icon buttons name their action in a tooltip too; TooltipProvider makes the next tooltip open at once.
API reference
Tooltip
| Prop | Type | Default | Description |
|---|---|---|---|
content | ReactNode | Figma's Text: one short sentence, no links or buttons. | |
children | ReactElement | The focusable element it explains. | |
side | "top" | "bottom" | "inline-start" | "inline-end" | "top" | Figma's Tooltip (position). |
align | "start" | "center" | "end" | "center" | Top left / Top right. |
arrow | boolean | true | Top no arrow. |
delay / open / defaultOpen / onOpenChange | … | Delay and open control. |
IconTooltip / DefinitionTooltip
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The info button's name; default “More information”. | |
children | ReactNode | Definition: the term (IBAN, APR). | |
…Tooltip props | … | As on Tooltip. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | Focusing the trigger shows the tooltip. |
| Escape | Hides the tooltip. |
ARIA
- The trigger carries
aria-describedbypointing at a hidden copy of the text that is always there, so the description is read even while the tooltip is closed. - Don't put anything needed to finish a task inside, and don't rely on it on touch-only screens.
Arabic and RTL notes
Mirrors
inline-startandinline-endmirror: Figma's “Left” becomes the right in Arabic.- The portaled bubble carries the page's direction and language.
Does not mirror
- The information icon doesn't mirror.
- Numerals
- Numbers in the text follow
numeralsthroughformatNumber. - Arabic typography
body-12; the taller Arabic line makes the bubble taller.- Mixed-direction text
- A Latin term like IBAN inside an Arabic sentence stays intact: it's an isolated button.