Skip to content

Tooltip

Get Ritla UI

Explains an icon or a term in a few words when people hover it or focus it with the keyboard.

Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned

Open in Figma

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add tooltip

    Also works with shadcn: npx shadcn@latest add @ritla/tooltip

  2. Dependencies it brings

    @base-ui/react@phosphor-icons/react

  3. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

tooltip.tsx
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.

EnglishMirroredArabic
LTR →

Toolbar

Icon buttons name their action in a tooltip too; TooltipProvider makes the next tooltip open at once.

EnglishMirroredArabic
LTR →

API reference

Tooltip

PropTypeDefaultDescription
contentReactNodeNoneFigma's Text: one short sentence, no links or buttons.
childrenReactElementNoneThe 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.
arrowbooleantrueTop no arrow.
delay / open / defaultOpen / onOpenChange…NoneDelay and open control.

IconTooltip / DefinitionTooltip

PropTypeDefaultDescription
labelstringNoneThe info button's name; default “More information”.
childrenReactNodeNoneDefinition: the term (IBAN, APR).
…Tooltip props…NoneAs 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.

KeyAction
TabFocusing the trigger shows the tooltip.
EscapeHides the tooltip.

ARIA

  • The trigger carries aria-describedby pointing 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-start and inline-end mirror: 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 numerals through formatNumber.
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.

Checks it passes

The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.

  • R042Clipped text: content wider than its box with overflow hidden and no ellipsis
  • R043Fixed-pixel-width container whose Arabic text exceeds the space
  • R050Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
  • R051letter-spacing applied to Arabic text (breaks the connected script)