Components
A tooltip displays a description of an element on hover or focus.
The HTML title attribute can be used to create a tooltip, but it cannot be styled. Custom styled tooltips can be hard to build in an accessible way. TooltipTrigger and Tooltip help build fully accessible tooltips that can be styled as needed.
Loading preview...
import { Pencil } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipTrigger } from "@/components/ui/tooltip"
export function TooltipDemo() {
return (
<TooltipTrigger>
<Button variant="outline" size="icon" aria-label="Edit">
<Pencil className="size-4" />
</Button>
<Tooltip>Edit</Tooltip>
</TooltipTrigger>
)
}