Primitives
Hover Card
Card that appears on hover — ideal for previews and profile chips.
Motionscale/opacity on tween.quick from transform origin
Install
Install Kineto and follow the theme setup once in your app.
bash
npm install kinetotsx
import {
HoverCard,
HoverCardTrigger,
HoverCardContent,
} from "kineto/hover-card";Preview
tsx
"use client";
import * as React from "react";
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
import { motion } from "motion/react";
import { cn } from "@/lib/cn";
import { tween } from "@/lib/motion-presets";
const HoverCard = HoverCardPrimitive.Root;
const HoverCardTrigger = HoverCardPrimitive.Trigger;
const HoverCardContent = React.forwardRef<
React.ElementRef<typeof HoverCardPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
>(({ className, align = "center", sideOffset = 8, children, ...props }, ref) => (
<HoverCardPrimitive.Portal>
<HoverCardPrimitive.Content
ref={ref}
align={align}
sideOffset={sideOffset}
className="z-50"
{...props}
>
<motion.div
initial={{ opacity: 0, scale: 0.97 }}
animate={{ opacity: 1, scale: 1 }}
transition={tween.quick}
style={{
transformOrigin: "var(--radix-hover-card-content-transform-origin)",
}}
className={cn(
"w-64 rounded-xl border border-border bg-popover p-4 text-popover-foreground shadow-lift outline-none",
className
)}
>
{children}
</motion.div>
</HoverCardPrimitive.Content>
</HoverCardPrimitive.Portal>
));
HoverCardContent.displayName = "HoverCardContent";
export { HoverCard, HoverCardTrigger, HoverCardContent };src/components/ui/hover-card.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| openDelay / closeDelay | number | — | Hover open/close delays (Radix). |
| align / sideOffset | Radix props | — | Placement relative to the trigger. |