Tooltip

A short label on hover or keyboard focus. It waits a beat the first time, opens instantly on a neighbour, flips at the screen edge, and Escape dismisses it. Overlays.

Open playground

About

Tooltip is a React component in the Overlays category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Tooltip } from "@ashutoshswamy/smoui" and set content, shortcut, side among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Tooltip } from "@ashutoshswamy/smoui";

<Tooltip content="Copy link" shortcut="C">
  <button>Share</button>
</Tooltip>

Props 4

content

The text. Keep it to a sentence.

ReactNode
shortcut

Keycap shown after the text.

string
side

Preferred side. It flips when there is no room.

"top""bottom"default "top"
delay

Wait before the first tooltip opens, in ms.

numberdefault 450