Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Installation

$ npx shadcn@latest add "/r/tooltip.json"

Usage

Examples

Sides

The tooltip can be positioned on different sides of the trigger using the side prop.

Side Offset

The sideOffset prop can be used to adjust the distance between the trigger and the content.

Props

TooltipProvider

PropTypeDefaultDescription
delaynumber200The duration from when the mouse enters a trigger until the tooltip opens.
skipDelayDurationnumber300How much time a user has to enter another trigger without again waiting for the delay.

Tooltip

PropTypeDefaultDescription
openboolean-The open state of the tooltip.
defaultOpenboolean-The initial open state.
onOpenChange(open: boolean) => void-Callback for when the open state changes.

TooltipContent

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""top"The preferred side of the anchor to render against when open.
sideOffsetnumber10The distance in pixels from the anchor.
classNamestring-Additional CSS classes to apply to the content.