Components
Cursor Tooltip
A tooltip that follows the cursor.
Read the docsOpens in a new tab
<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.jsonimport { 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
| Prop | Type | Default | Description |
|---|---|---|---|
content | string | The label. | |
children | ReactElement | One focusable element. |
It only moves with your own cursor, so reduced motion changes nothing.