Components

Tooltip

An animated React tooltip built on shadcn/ui and Radix: the drop-in Tooltip opens from its trigger with a short fade and scale on an elevated dark surface — plus Motion blocks for a spring tooltip with a one-line API and an overlapping avatar group whose name cards tilt toward the cursor.

  • Drop-in shadcn API
  • Radix Tooltip
  • Spring animation
  • Motion values
  • prefers-reduced-motion

Installation

$ npx shadcn@latest add https://duskui.com/r/tooltip.json

Replaces components/ui/tooltip.tsx with the same parts and props, so the shadcn Sidebar and any existing tooltips keep working. CSS only (tw-animate-css).

Usage

copy-button.tsx
import { Copy } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"

export function CopyButton() {
  return (
    <Tooltip>
      <TooltipTrigger asChild>
        <Button variant="outline" size="icon" aria-label="Copy link">
          <Copy />
        </Button>
      </TooltipTrigger>
      <TooltipContent>Copy link</TooltipContent>
    </Tooltip>
  )
}

Examples

Default

Hover or Tab to an icon button. The tooltip grows out of the trigger and closes faster than it opens.

Sides

side on TooltipContent picks where it opens; it slides in from that side and flips automatically near the viewport edge.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Animated Tooltip

A spring tooltip with a one-line API: wrap any trigger and pass content. It scales up from the Radix transform origin, travels a few pixels away from the side it opens on, then fades back on exit thanks to AnimatePresence and forceMount.

$ npx shadcn@latest add https://duskui.com/r/animated-tooltip.json
PropTypeDefaultDescription
contentReactNode—What the tooltip says. Required.
childrenReactElement—The trigger; must accept a ref (button, link, Button).
side"top" | "right" | "bottom" | "left""top"Preferred side; flips on collision.
sideOffsetnumber2 (8 without arrow)Distance from the trigger in px.
delayDurationnumber150Hover delay before opening, in ms.
showArrowbooleantrueRender the arrow.
open / defaultOpen / onOpenChangeboolean / (open: boolean) => void—Controlled or initial state.
align / collisionPadding / className…Radix TooltipContent props—Forwarded to the content.

Avatar Tooltip Group

Overlapping avatars for teams and collaborators. Hovering one lifts it above its neighbours and opens a name card that tilts slightly toward the cursor as you move across the face — driven by motion values, so it never re-renders React. Extra members collapse into a “+N” chip whose tooltip lists them. Uses plain <img> or generated initials.

$ npx shadcn@latest add https://duskui.com/r/avatar-tooltip-group.json
PropTypeDefaultDescription
items{ name, role?, src?, initials? }[]—The people. Without src, initials sit on a muted color derived from the name.
maxnumber5Avatars shown before the +N chip.
sizenumber40Avatar diameter in px.
onAvatarClick(item) => void—Called when an avatar is clicked.
aria-labelstring—Names the group, e.g. “Project members”.

API Reference

Same parts as shadcn/ui: TooltipProvider, Tooltip, TooltipTrigger and TooltipContent, each forwarding its Radix Tooltip props. Like shadcn, Tooltip wraps itself in a provider so it works anywhere.

PropTypeDefaultDescription
side / align"top" | "right" | "bottom" | "left" / "start" | "center" | "end""top" / "center"On TooltipContent.
sideOffsetnumber0On TooltipContent: distance from the trigger (the arrow adds its own height).
showArrowbooleantrueOn TooltipContent: render the arrow.
delayDurationnumber0On TooltipProvider or Tooltip: hover delay in ms.
open / defaultOpen / onOpenChangeboolean / (open: boolean) => void—On Tooltip: controlled or initial state.

Accessibility

  • Built on Radix Tooltip: opens on hover and keyboard focus, closes on Escape and pointer-down, and links the trigger with aria-describedby.
  • Tooltips describe, they don't name: icon-only triggers still need an aria-label.
  • Every avatar in the group is a focusable button named after the person, and the +N chip's name lists the hidden members.
  • Under prefers-reduced-motion tooltips only fade, and the avatar lift and tooltip tilt are turned off.