videorc/ui

Tooltip

A short label for a control on the tooltip tier of the float glass. It waits 600 ms for a deliberate hover, and its neighbours under one provider then open at once.

Installation

$ pnpm dlx shadcn@latest add @videorc/tooltip

Usage

import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@/components/ui/tooltip";
<Tooltip>
  <TooltipTrigger
    render={<Button aria-label="Keep on top" size="icon" variant="ghost" />}
  >
    <PinIcon />
  </TooltipTrigger>
  <TooltipContent>Keep on top</TooltipContent>
</Tooltip>

Mount one TooltipProvider around each window. Tooltips under it share a delay group: once one is open, moving to the next opens it at once. A tooltip outside every provider still works, with its trigger's own 600 ms.

Anatomy

<TooltipProvider>
  <Tooltip>
    <TooltipTrigger />
    <TooltipContent />
  </Tooltip>
</TooltipProvider>

Examples

With a shortcut

Put a Shortcut keys chip after the label to show the bound shortcut. The tooltip tightens its end padding around the chip.

Theming

Token or attributeMeaning
glass-float-tooltipThe tooltip tier: the window's solid tone, a 1 px rim and the float drop
rounded-row8 px corners
text-xs12 px text, never an inverted pill
data-open, data-closedFades and scales from 0.98 in 100 ms, with no slide
data-sideThe side it opened on

Keyboard

KeyAction
TabFocusing the trigger opens its tooltip
EscapeCloses the tooltip

Accessibility

A tooltip is never the only place a fact lives, and title= is not an information channel. An icon-only trigger still needs its own aria-label: the tooltip repeats the name for sighted users. A disabled control takes no hover, so explain it with Disabled reason.

API reference

Every Base UI Tooltip prop, plus:

TooltipProvider

Prop

Type

TooltipContent

Prop

Type