Skip to content
GitHub

Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

import { Button } from "@/components/ui/pxl/button";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/pxl/tooltip";
export default function TooltipDemo() {
return (
<Tooltip>
<TooltipTrigger render={<Button variant="outline">Hover</Button>} />
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>
);
}
pnpm dlx shadcn@latest add pxl-ui/registry/tooltip

Add the TooltipProvider to the root of your app.

app/layout.tsx
import { TooltipProvider } from "@/components/ui/pxl/tooltip"
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<TooltipProvider>{children}</TooltipProvider>
</body>
</html>
)
}
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/pxl/tooltip"
<Tooltip>
<TooltipTrigger>Hover</TooltipTrigger>
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>

Use the following composition to build a Tooltip:

Tooltip
├── TooltipTrigger
└── TooltipContent

Use the side prop to change the position of the tooltip.

See the Base UI Tooltip documentation.