Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Tooltip

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

Installation

npx logic2b@latest add tooltip

Usage

import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"

<Tooltip>
  <TooltipTrigger>Hover</TooltipTrigger>
  <TooltipContent>Add to library</TooltipContent>
</Tooltip>

API

Prop Type Default
delayDuration (TooltipProvider) number (ms) 0
sideOffset (TooltipContent) number 0

Note: Tooltip wraps itself in a TooltipProvider, so it works standalone. Wrap your app in a single TooltipProvider to share delay settings across multiple tooltips.

TooltipContent also accepts Radix positioning props such as side (top \| right \| bottom \| left) and align.

Examples

Sides

On an icon button

Accessibility

  • The tooltip opens on hover and on keyboard focus of the trigger, and closes on Escape.
  • Use TooltipTrigger asChild so the tooltip attaches to a real interactive element (e.g. a Button) that can receive focus.
  • Tooltips supplement, but do not replace, an accessible name — give icon-only triggers their own aria-label.