Tooltip

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/tooltip

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components tailwind-merge tailwind-variants

Anatomy

import { IconBrandX } from "@heroicons/react"
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@/components/ui/tooltip"
<Tooltip>
  <TooltipTrigger aria-label="Follow My Twitter">
    <IconBrandX />
  </TooltipTrigger>
  <TooltipContent>Follow me on X @irsyadadl</TooltipContent>
</Tooltip>

Examples

Placement

By default, the tooltip appears at the top, but you can change its position by using the placement prop.

Loading...

Intent

Tooltip has two intents: default and inverse. You can change the intent by using the intent prop.

Loading...

Without arrow

You can remove the arrow from the tooltip by setting the arrow prop to false.

Loading...

Directions

The list above shows the primary directions, but you can also use more specific placements like bottom left or top right. Here are all the available placement options:

Primary DirectionPlacement
bottombottom, bottom left, bottom right, bottom start, bottom end
toptop, top left, top right, top start, top end
leftleft, left top, left bottom
startstart, start top, start bottom
rightright, right top, right bottom
endend, end top, end bottom

Delay

Tooltip rolls out the welcome mat after you hover for 1.5 secs. Wanna speed it up or slow it down? Just slide in a delay prop. Peep these guidelines for the scoop.

Loading...

Component API

Tooltip

Tooltip extends the React Aria Components <TooltipTrigger> component.

TooltipTrigger

TooltipTrigger extends the React Aria Components <Button> component.

TooltipContent

TooltipContent extends the React Aria Components <Tooltip> component.

arrowboolean
Default: true
classNamestring
inversetrue | false
Default: false

See the React Aria for the full API reference.

Design