Docs
Tooltip
Tooltip
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
This component uses Radix UI
import { Button } from 'ui'
import {
Tooltip_Shadcn_,
TooltipContent_Shadcn_,
TooltipProvider_Shadcn_,
TooltipTrigger_Shadcn_,
} from 'ui'
export function TooltipDemo() {
return (
<TooltipProvider_Shadcn_>
<Tooltip_Shadcn_>
<TooltipTrigger_Shadcn_ asChild>
<Button type="outline">Hover</Button>
</TooltipTrigger_Shadcn_>
<TooltipContent_Shadcn_>
<p>Add to library</p>
</TooltipContent_Shadcn_>
</Tooltip_Shadcn_>
</TooltipProvider_Shadcn_>
)
}
Installation
npx shadcn-ui@latest add tooltip
Usage
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
<TooltipProvider>
<Tooltip>
<TooltipTrigger>Hover</TooltipTrigger>
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>