beadboard/components/ui/tooltip.tsx
zenchantlive 3e3eedeead feat(ui): complete bb-ui2.2 - shadcn/ui Setup
STORY:
The Unified UX epic needed a solid component foundation. We chose
shadcn/ui for its Tailwind integration and copy-paste philosophy.

COLLABORATION:
Initialized shadcn/ui with Next.js defaults and installed the base
component set needed for the unified shell:
- button: Primary actions
- card: Card containers
- badge: Status badges
- avatar: Agent avatars
- input: Search/filter inputs
- scroll-area: Scrollable containers
- separator: Visual dividers
- tooltip: Hover information
- dropdown-menu: Sorting and filtering

We also updated tsconfig.json with path aliases (@/*) to support
the shadcn import pattern.

DELIVERABLES:
- components.json configuration
- 9 shadcn components in components/ui/
- lib/utils.ts with cn() helper
- tsconfig.json with @/* path aliases

VERIFICATION:
- npm run typecheck: PASS
- npm run lint: PASS

CLOSES: bb-ui2.2
BLOCKS: bb-ui2.3, bb-ui2.5
2026-02-15 21:16:26 -08:00

32 lines
1.2 KiB
TypeScript

"use client"
import * as React from "react"
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
import { cn } from "@/lib/utils"
const TooltipProvider = TooltipPrimitive.Provider
const Tooltip = TooltipPrimitive.Root
const TooltipTrigger = TooltipPrimitive.Trigger
const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
className
)}
{...props}
/>
</TooltipPrimitive.Portal>
))
TooltipContent.displayName = TooltipPrimitive.Content.displayName
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }