View fulldotdev/ui on GitHub

Tooltip

Displays contextual information when a user hovers or focuses a trigger.

Installation

npx shadcn@latest add @fulldev/tooltip

Usage

import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@/components/ui/tooltip"
<Tooltip>
  <TooltipTrigger>Hover</TooltipTrigger>
  <TooltipContent>
    <p>Add to library</p>
  </TooltipContent>
</Tooltip>

TooltipTrigger renders an unstyled button, or an a with href. Pass as="span" or as="div" for another element, and class={buttonVariants({ variant: "outline" })} for button styles.

Composition

Tooltip
├── TooltipTrigger
└── TooltipContent

Side

Use the side prop on TooltipContent or Tooltip to change the position of the tooltip. Logical sides inline-start and inline-end follow the text direction.

With Keyboard Shortcut

Disabled Button

Show a tooltip on a disabled button by wrapping it with <TooltipTrigger as="span">.

RTL

Content mounting

Data Slot’s recommended "lazy" strategy is the default: closed content is retained but detached from the document. Fulldev initializes nested Data Slot components inside that retained content too.

Use mountStrategy="eager" when an integration needs to query closed content through the document. Both strategies include content in server-rendered HTML; neither adds a no-JavaScript fallback.

API Reference

Source: src/components/ui/tooltip

Tooltip

PropTypeDefault
delaynumber300
skipDelayDurationnumber300
side"top" | "right" | "bottom" | "left" | "inline-start" | "inline-end""top"
align"start" | "center" | "end""center"
sideOffsetnumber4
alignOffsetnumber0
avoidCollisionsbooleantrue
collisionPaddingnumber8
mountStrategy"lazy" | "eager""lazy"

TooltipContent takes the same placement props and overrides the root.

See the Data Slot tooltip docs for events and programmatic control.