V-/Srcv0.1.0beta
// tooltip
A small glass pill on hover or focus.
npx shadcn add @vsrc/tooltipOnly the vsrc surface is documented here. Everything else passes through to Radix Tooltip.
// TooltipContent
| prop | type | default | notes |
|---|---|---|---|
| glass | "subtle" | "regular" | "heavy" | LiquidGlassOptions | false | — | Optics override for the pill. A preset name replaces the tuned values, an object merges over them, `false` disables refraction entirely. |
TIP_OPTICS: scale −32, chroma 2, border 0.2, mapBlur 5, blur 2, saturate 1.3 — switch-class tuning for the second-smallest pane in the registry.
The exact file the CLI copies into your project — you own it after install.
"use client";
import * as React from "react";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { mergeGlass, type GlassPreset, type LiquidGlassOptions } from "vsrc/react";
import { GlassSurface } from "@/registry/vsrc/ui/glass-surface";
import { cn } from "@/lib/utils";
const TIP_OPTICS: LiquidGlassOptions = {
scale: -32,
chroma: 2,
border: 0.2,
mapBlur: 5,
blur: 2,
saturate: 1.3,
fallbackBlur: 2,
};
const TooltipProvider = TooltipPrimitive.Provider;
const Tooltip = TooltipPrimitive.Root;
const TooltipTrigger = TooltipPrimitive.Trigger;
function TooltipContent({
className,
sideOffset = 6,
glass,
...props
}: React.ComponentProps<typeof TooltipPrimitive.Content> & { glass?: LiquidGlassOptions | GlassPreset | false }) {
return (
<TooltipPrimitive.Portal>
<GlassSurface asChild glass={mergeGlass(TIP_OPTICS, glass)}>
<TooltipPrimitive.Content
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
"animate-glass-in relative z-50 rounded-full px-3 py-1.5 text-xs text-foreground",
className,
)}
{...props}
/>
</GlassSurface>
</TooltipPrimitive.Portal>
);
}
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };