Talisman LogoTalisman Logo Design System
Browse documentation
Components

Tooltip

A short label shown on hover or keyboard focus that names a control or explains why it is unavailable, built on Radix Tooltip.

Stableimport { Tooltip } from "@repo/ui/tooltip";Source

Hover the button or focus it with Tab to see the label.

When to use

  • To name an icon-only button: “Atualizar painel”, “Excluir tarefa”.
  • To explain in one line why an action is unavailable: “Anexe a petição inicial para enviar.”
  • To expand an abbreviation or give a short hint for a control that already has a visible label.

When not to use

  • Content the user needs to read, or anything with links, buttons or fields. Use Popover. A tooltip closes as soon as the pointer or the focus leaves.
  • Text longer than a short sentence. Put it on the page, or use a Popover.
  • Confirmation of an action. Use a toast (Sonner).
  • Anything touch users must reach. There is no hover on touch screens. Show the text on the page.
  • A decision. Use Dialog.

Anatomy

Part Role
TooltipProvider Shares the delays. Required above every Tooltip; the tooltip fails without it.
Tooltip Holds the open state.
TooltipTrigger The element that opens it. Use asChild with a Button.
TooltipContent The dark label. Pick side; it flips when there is no room.

Wrap the tooltip, or a whole region with many tooltips, in one TooltipProvider.

Examples

Sides

Why an action is unavailable

Use aria-disabled instead of disabled on the trigger. A disabled button cannot take focus, so keyboard users would never see the reason.

Delays

The provider sets how long the first tooltip waits (delayDuration) and how long after closing the next one opens at once (skipDelayDuration). The Radix default wait is 700ms.

Content

  • Name the control as a verb or a noun phrase, in sentence case, without a period: “Excluir tarefa”.
  • One line. If you need two, the content belongs on the page.
  • Repeat the accessible name of an icon button; do not add new information.
  • Never put the only copy of important information in a tooltip.

Do and don’t

DoKeep it to a short name of the action.
Don'tDon't write paragraphs. The text disappears when the pointer moves.

Accessibility

  • Built on Radix Tooltip. It opens on pointer hover and on keyboard focus, and closes on blur, on pointer leave and with Escape.
  • The content is linked to the trigger with aria-describedby, so a screen reader reads it as a description. A tooltip does not replace an accessible name: give icon buttons an aria-label too.
  • The pointer can move onto the tooltip without closing it.
  • The trigger must be focusable. A disabled button is not, so use aria-disabled.
  • The tooltip is not shown on touch devices. Do not rely on it there.

Code

import { Button } from "@repo/ui/button";
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@repo/ui/tooltip";
import { RefreshCwIcon } from "lucide-react";

<TooltipProvider>
  <Tooltip>
    <TooltipTrigger asChild>
      <Button
        aria-label="Atualizar painel"
        size="xsIcon"
        type="button"
        variant="secondary"
      >
        <RefreshCwIcon aria-hidden="true" className="size-4" />
      </Button>
    </TooltipTrigger>
    <TooltipContent>Atualizar painel</TooltipContent>
  </Tooltip>
</TooltipProvider>;

Props

Tooltip
PropTypeDefaultDescription
defaultOpenbooleanfalseInitial open state when the tooltip is uncontrolled
delayDurationnumber700Milliseconds before it opens on hover. Overrides the provider value
onOpenChange(open: boolean) => void—Called when the tooltip opens or closes
openboolean—Controlled open state
TooltipProvider
PropTypeDefaultDescription
delayDurationnumber700Milliseconds before the first tooltip opens on hover.
skipDelayDurationnumber300How long after a tooltip closes the next one opens without delay.
disableHoverableContentbooleanfalseCloses the tooltip when the pointer leaves the trigger, even onto the tooltip.
TooltipTrigger
PropTypeDefaultDescription
asChildbooleanfalseUses the child element as the trigger instead of a button.
TooltipContent
PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""top"Preferred edge. It flips when there is no room.
align"start" | "center" | "end""center"Alignment along the chosen edge.
sideOffsetnumber4Distance in pixels from the trigger.

Known issues

Issue Effect
Tooltip does not include its own provider. Using it outside a TooltipProvider throws. Every call site has to wrap it, and many apps repeat it.
The content uses animate-in/animate-out with no motion-reduce variant. The fade and slide play for users who asked for reduced motion.
The content has no maximum width. A long text grows into a wide strip across the page. Keep the text short or set max-w-* on the content.
The text size is a raw text-sm class instead of a Typography variant, and the border uses the default border color. The tooltip does not follow the type scale and border tokens.
TooltipContent is z-50, while PopoverContent is z-[100]. A tooltip opened from inside a popover can render behind it.
Edit this page on GitHub