Docs
Tooltip
Tooltip
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
import * as React from "react";
import { Button } from "@/components/ui/button";
import {
Tooltip,
TooltipArrow,
TooltipContent,
TooltipPositioner,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
export function TooltipExample(): React.JSX.Element {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger render={<Button variant="outline">Hover</Button>} />
<TooltipPositioner side="top" sideOffset={4}>
<TooltipContent>
<TooltipArrow />
Add to library
</TooltipContent>
</TooltipPositioner>
</Tooltip>
</TooltipProvider>
);
}
Installation
npx lotru@latest add ui/tooltip
Usage
import { Tooltip } from "@/components/ui/tooltip";
<TooltipProvider>
<Tooltip>
<TooltipTrigger>Hover</TooltipTrigger>
<TooltipPositioner>
<TooltipContent>Add to library</TooltipContent>
<TooltipArrow />
</TooltipPositioner>
</Tooltip>
</TooltipProvider>
On this page