Skip to content

Tooltip

A popup that appears when an element is hovered or focused, showing a hint for sighted users.

API Reference

Installation

pnpm dlx shadcn@latest add @frontal-labs/tooltip

Usage

import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
<Tooltip>
  <TooltipTrigger render={<Button variant="outline" />}>Hover me</TooltipTrigger>
  <TooltipContent>Helpful hint</TooltipContent>
</Tooltip>

API Reference

Tooltip

Root component. Alias for Tooltip.Root from Base UI.

TooltipTrigger

Trigger element that shows the tooltip on hover/focus. Alias for Tooltip.Trigger from Base UI.

TooltipContent

Popup container that displays the tooltip content.

The tooltip surface is deliberately inverted (bg-foreground text-background), so it does not take the dark prop that the other portaled surfaces expose.

TooltipProvider

Provider for grouping tooltips. Styled wrapper for Tooltip.Provider from Base UI with delay defaulting to 0.

Examples

Grouped Tooltips

To group multiple tooltips so they appear instantly after the first one is opened, wrap them in TooltipProvider. The grouping logic ensures that once a tooltip becomes visible, the adjacent tooltips will be shown instantly.