Overlays

Tooltip

A short label on hover or focus, dark with an arrow. Each Tooltip brings its own provider, with no delay.

packages/design-system/components/ui/tooltip.tsx

Examples

On an icon button. Hover it
Sides

Anatomy

  1. 01Trigger
  2. 02Popup, foreground fill, text-xs
  3. 03Arrow

Usage

import { Tooltip, TooltipContent, TooltipTrigger } from "@repo/design-system/components/ui/tooltip";

<Tooltip>
  <TooltipTrigger render={<Button size="icon" variant="outline" aria-label="Add" />}>
    <PlusIcon />
  </TooltipTrigger>
  <TooltipContent>Add a block</TooltipContent>
</Tooltip>

Props

PropTypeDefaultDescription
TooltipTrigger renderReactElement | (props, state) => ReactElementnoneBase UI's replacement for asChild: render the part as another element, such as a Button or a Link.
side"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"noneWhich side of the trigger the popup opens on.
align"start" | "center" | "end""center"How the popup lines up with the trigger along that side.
sideOffsetnumber4The gap between trigger and popup, in pixels.
TooltipProvider delaynumber0Every Tooltip is wrapped in a provider already. Wrap a group in your own to share a delay.
classNamestringnoneMerged last with cn(). Use it for layout (width, margin), not to restyle the component.

Guidance

Do

  • Name icon-only buttons with it, and keep the aria-label too.

Don't

  • Put anything clickable or essential in it; touch screens never see it.