Accessible React tooltips with flexible placement, collision handling, disabled triggers, and custom designs.
Requires React 19, React DOM 19, and Tailwind CSS 4.
npm install @rentnerkev/tooltips
# or with Bun
bun add @rentnerkev/tooltipsAdd to your application stylesheet:
@import 'tailwindcss';
@import '@rentnerkev/tooltips/tailwind.css';'use client'
import { CustomTooltip, TooltipProvider } from '@rentnerkev/tooltips'
export function App() {
return (
<TooltipProvider delayDuration={200}>
<CustomTooltip content="Save your changes" side="top">
<button type="button">Save</button>
</CustomTooltip>
</TooltipProvider>
)
}Configure shared classes once on the native TooltipProvider:
import { CustomTooltip, TooltipProvider } from '@rentnerkev/tooltips'
import type { TooltipCustomDesign } from '@rentnerkev/tooltips'
const tooltipDesign = {
baseClasses:
'rounded-lg border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-white shadow-lg',
arrowClasses: 'fill-slate-900',
} satisfies TooltipCustomDesign
export function Actions() {
return (
<TooltipProvider customDesign={tooltipDesign} delayDuration={200}>
<CustomTooltip content="Uses the shared design">
<button type="button">Save</button>
</CustomTooltip>
<CustomTooltip
content="Overrides only the content classes"
customDesign={{ contentClasses: 'font-semibold' }}
>
<button type="button">Publish</button>
</CustomTooltip>
<TooltipProvider customDesign={{ contentClasses: 'text-center' }}>
<CustomTooltip content="Inherits the shared base and arrow">
<button type="button">Details</button>
</CustomTooltip>
</TooltipProvider>
</TooltipProvider>
)
}Design properties resolve in this order: package defaults, outer provider,
nested providers, then the tooltip's local customDesign. Only supplied
properties replace inherited values; each class string replaces that entire
property. Use '' to clear a property's classes. Without customDesign, the
existing default and standalone behavior remains available.
Nested providers scope design overrides while sharing the outer shared provider,
opening delay, skip-delay window, and hover behavior. Use a tooltip's own
delayDuration for a local timing override.
Shared provider and top placement![]() |
Dark design and right placement![]() |
Disabled control explanation![]() |
Automatic collision correction![]() |
Run the local Playground from a repository checkout:
bun install --cwd playground
bun run playground:devFull API and usage guide · Local Playground · Changelog · MIT license
The separate @rentnerkev/tooltips/ai entry is for Node.js and Bun tooling. It reads
only this installed package's manifest, README, usage guide, and built TypeScript
declarations. It does not import React, mount UI, run examples, perform network
requests, or require an MCP runtime. Keep it in server/tooling code.
import {
getPackageInfo,
getPackageApi,
getPackageDocumentation,
searchPackageDocumentation,
getPackageExamples,
} from '@rentnerkev/tooltips/ai'
const info = getPackageInfo()
const api = getPackageApi() // All public typed subpaths and dependent declarations
const usage = getPackageDocumentation('usage') // Full guide, including CSS and providers
const readme = getPackageDocumentation('readme')
const matches = searchPackageDocumentation('messages') // Literal, case-insensitive lines
const examples = getPackageExamples() // Fenced examples from the usage guidegetPackageApi({ subpath: '.', symbol: 'CustomTooltip' }) validates the symbol
against the selected public entry and returns its complete declaration context.
Unknown subpaths or symbols throw an error. File paths are not accepted. The
./ai entry itself is excluded from this UI API context. The manifest's exports
map remains available through getPackageInfo().
Public website discovery is planned at
llms.txt and
the MCP endpoint. These addresses become
available after the website deployment; this documentation does not claim the
endpoint is already online. The website's read-only tools expose public package
information, API declarations, usage guides, examples, and search, without
accounts, write operations, or access to private project files. The installed
/ai entry works locally without that service. Always use the documentation and
declarations for the version installed in your project.
Provider positioning/portal defaults, shared theme tokens and wrapper removal examples are documented in the usage guide.
See Contributing, the Code of Conduct, Support, and the Security Policy.




