Tooltip
FeedbackPopup hint that appears on hover or focus. Positioned automatically.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@dashboardpack/core/components/ui/tooltip";
import { Button } from "@dashboardpack/core/components/ui/button";
import { Plus } from "lucide-react";
export default function TooltipExample() {
return (
<TooltipProvider delayDuration={200}>
<div className="flex gap-4">
{(["top", "right", "bottom", "left"] as const).map((side) => (
<Tooltip key={side}>
<TooltipTrigger asChild>
<Button
size="icon"
variant="outline"
aria-label={`Add project (${side} hint)`}
>
<Plus />
</Button>
</TooltipTrigger>
<TooltipContent side={side}>Create a project</TooltipContent>
</Tooltip>
))}
</div>
</TooltipProvider>
);
}Usage
Use for short, supplementary hints. Wrap tooltips in TooltipProvider and use asChild to retain the semantics of the trigger. Essential instructions belong in visible content.
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@dashboardpack/core/components/ui/tooltip";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| delayDuration (TooltipProvider) | numberDefault: 0 | Milliseconds before showing a hint. |
| side (TooltipContent) | top | right | bottom | leftDefault: top | Preferred physical placement. |
| sideOffset (TooltipContent) | numberDefault: 0 | Gap from the trigger. |
| open / onOpenChange | boolean / (open: boolean) => voidDefault: — | Optional controlled visibility. |