Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Tooltip

A short label that appears when the reader hovers or focuses an element.

Built on the headless Tooltip.See its API in Docs

Rendered by React 19.3.1

tooltip.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/tooltip.json

It also adds utils. The app needs its setup first: Installation.

Usage

Tooltip holds TooltipTrigger and TooltipContent; the content brings its own portal, positioner and arrow, and takes side (top by default), sideOffset, align and alignOffset. Wrap a group of tooltips in TooltipProvider so that moving from one trigger to the next opens the next at once; its delay is 0 by default. In Angular the template writes baseTooltipPortal itself. Delays, the hover and focus logic and the accessible name come from the headless Tooltip. A tooltip is not reached by touch, so keep what it says available elsewhere.

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

Examples

Default

A button with its tooltip above.

Its preview and code are at the top of the page.

Side

One tooltip on each of the four sides.

Rendered by React 19.3.1

tooltip-side.tsx

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Tooltip's API reference.