Rime

Tooltip and Toggletip

Hover and focus tooltips (dark one-liners or light rich cards) and click-to-open toggletips for help.

Tooltip labels a control on hover and focus after a short delay; it can show a keyboard shortcut and only appear when text is truncated. Toggletip is an info button that opens a small panel on click, for help text people need to read.

Installation

npx shadcn@latest add KezLahd/rime/tooltip

Also installs: base, icon.

Usage

import { Toggletip, Tooltip } from "@/components/ui";

<Tooltip content="Print invoice"><IconButton label="Print" icon={<IconPrinter size={17} />} /></Tooltip>

Examples

Open

inline shows the bubble and the toggletip panel open beside their triggers, in place.
SeatsEach plan includes five seats. Add more from Billing.
Seats. Each plan includes five seats. Add more from Billing.

Tooltip and toggletip

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

Tooltip

Tooltip props
PropTypeDefaultDescription
contentRequiredReactNodeSupplementary text only. Never the sole label of a control, never the only place essential information lives.
titleReactNodeMakes it a rich tooltip: a bold first line above the content.
footerReactNodeRich tooltip: a quiet line under a hairline (a source, a caveat). Not interactive: use Toggletip for a link.
shortcutReadonlyArray<string>Keys shown as badges after the content, e.g. ["Ctrl", "K"]. Also sets aria-keyshortcuts on the trigger.
childrenRequiredReactElement<TriggerProps>One focusable element (a button, a link). Its handlers are preserved. A disabled button fires no pointer or focus events: wrap it in TooltipTarget.
sideTooltipSide"top"Preferred side. Flips to the opposite side when there is no room.
delaynumber400Hover delay in ms. Focus shows at once; so does hover within 400 ms of another tooltip closing.
tone"dark" | "light"dark (default for plain) or light (default for rich).
maxWidthnumberDefault 240 plain, 300 rich.
onlyWhenTruncatedbooleanfalseOnly open when the trigger's text is clipped (an ellipsised cell). The text is already in the DOM, so no aria-describedby is added.
disabledbooleanfalseSwitch the tooltip off without unwrapping the trigger.
inlinebooleanfalseShow the bubble open, in place beside its trigger: no portal, no listeners. For docs and thumbnails.

Toggletip

Toggletip props
PropTypeDefaultDescription
labelRequiredstringThe (i) button's accessible name: "Why we ask for a billing address".
titleReactNode
childrenRequiredReactNode
footerReactNodeMay hold a link: a toggletip is interactive, a tooltip is not.
sideTooltipSide"top"
maxWidthnumber300
iconReactNode
classNamestring
inlinebooleanfalseShow the panel open, in place beside the button: no portal, no listeners. For docs and thumbnails.

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

Tooltip and Toggletip per-component tokens
TokenDefaultLive value
--arrow50%…
--r-flat2px…
--tooltip-bgvar(--brand-deep)…
--tooltip-radiusvar(--r-sm)…

System tokens it reads

Tooltip and Toggletip system tokens
TokenDefaultLive value
--border-wtokens.css…
--brand-deeptokens.css…
--densitytokens.css…
--durtokens.css…
--dur-fasttokens.css…
--easetokens.css…
--ease-outtokens.css…
--focus-colortokens.css…
--focus-ringtokens.css…
--font-bodytokens.css…
--font-monotokens.css…
--ink-bodytokens.css…
--ink-brandtokens.css…
--ink-disabledtokens.css…
--ink-headingtokens.css…
--ink-inversetokens.css…
--ink-mutedtokens.css…
--ink-secondarytokens.css…
--linetokens.css…
--line-brandtokens.css…
--line-inputtokens.css…
--r-2xstokens.css…
--r-fulltokens.css…
--r-mdtokens.css…
--r-smtokens.css…
--r-xstokens.css…
--rgb-contacttokens.css…
--rgb-whitetokens.css…
--shadow-floattokens.css…
--shadow-menutokens.css…
--shadow-specular-darktokens.css…
--surface-solidtokens.css…
--surface-sunkentokens.css…
--text-captiontokens.css…
--text-microtokens.css…
--wash-activetokens.css…
--wash-hovertokens.css…
--wash-strongtokens.css…
--z-tooltiptokens.css…

Accessibility

  • Tooltip content is the trigger's description (aria-describedby), shown on focus too, dismissed with Esc.
  • Toggletip content is announced through a live region when opened.

Do and don't

Do

  • Keep tooltips to a few words.

Don't

  • Don't put interactive content in a Tooltip; use a Toggletip.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open tooltip.md