Skip to content
Pixelbits
Docs / Tooltip
Overlays

Tooltip

A short label that appears on hover and on keyboard focus, linked to its element with aria-describedby. Escape hides it. Never put interactive content or essential information only in a tooltip.

Installation

npm: import
import { Tooltip } from "pixelbits/tooltip";
shadcn: copy the source
npx shadcn add https://pixelbits.ali-moradi-develop.com/r/tooltip.json

API

<Tooltip>

A short label that appears on hover and on keyboard focus, linked to its element with aria-describedby. Escape hides it. Never put interactive content or essential information only in a tooltip.

Example
<Tooltip content="Copy to clipboard">
  <IconButton aria-label="Copy"><CopyIcon /></IconButton>
</Tooltip>
PropTypeDefaultDescription
content*ReactNode—

The text (keep it short, plain text works best).

children*ReactElement—

The element it describes: must be focusable (a button, a link).

delaynumber400

Delay before showing on hover, in ms. Keyboard focus shows it at once.

align"start" | "center" | "end""center"

Horizontal alignment with the element.

classNamestring—

Extra classes for the tooltip bubble.