Skip to Content
zjkm-ui
Components

Cursor Tooltip

A tooltip that follows the cursor.

Read the docs
Props
<CursorTooltip content="Opens in a new tab">
  <a href="…">Read the docs</a>
</CursorTooltip>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/cursor-tooltip.json
import { CursorTooltip } from "@/components/cursor-tooltip"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

A small label that follows the mouse while it's over the element. Keyboard focus has no cursor, so then it sits under the element instead.

import { CursorTooltip } from "@/components/cursor-tooltip";

export function ExternalLink() {
  return (
    <CursorTooltip content="Opens in a new tab">
      <a href="https://example.com" target="_blank">Read the docs</a>
    </CursorTooltip>
  );
}

Props

PropTypeDefaultDescription
contentstringThe label.
childrenReactElementOne focusable element.

It only moves with your own cursor, so reduced motion changes nothing.

On this page