BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/trovecn/tooltip

Tooltip

trovecn/tooltip
FreeComponent

Fast, fading label with minimal collision-aware travel from its trigger.

Install it

npx shadcn@latest add https://trovecn.dev/r/tooltip.json

Source

src/components/ui/tooltip.tsxtrovecn.dev/r/tooltip.json
1"use client";
2
3import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
4import { motion, useReducedMotion } from "motion/react";
5
6import { cn } from "@/lib/utils";
7import { spring } from "@/lib/springs";
8import { fontWeights } from "@/lib/font-weight";
9
10/** Fast, deliberate — a tooltip that opened as slowly as a dialog would feel
11 * laggy for something this small; 200ms strikes the balance between
12 * "confirms intent" and "instant." */
13const defaultDelay = 200;
14
15function TooltipProvider({ delay = defaultDelay, ...props }: TooltipPrimitive.Provider.Props) {
16 return <TooltipPrimitive.Provider data-slot="tooltip-provider" delay={delay} {...props} />;
17}
18
19function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
20 return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
21}
22
23function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
24 return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
25}
26
27/** A few pixels of slide toward the trigger, on top of the fade. Base UI's
28 * resolved side keeps that cue correct when collision handling flips the
29 * placement. */
30function slideOffset(side: NonNullable<TooltipPrimitive.Positioner.Props["side"]>) {
31 switch (side) {
32 case "top":
33 return { y: 4 };
34 case "bottom":
35 return { y: -4 };
36 case "left":
37 return { x: 4 };
38 case "right":
39 return { x: -4 };
40 default:
41 return {};
42 }
43}
44
45function TooltipContent({
46 className,
47 side = "top",
48 sideOffset = 8,
49 align = "center",
50 alignOffset = 0,
51 children,
52 ...props
53}: TooltipPrimitive.Popup.Props &
54 Pick<TooltipPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">) {
55 const reduceMotion = useReducedMotion();
56
57 return (
58 <TooltipPrimitive.Portal>
59 <TooltipPrimitive.Positioner
60 data-slot="tooltip-positioner"
61 align={align}
62 alignOffset={alignOffset}
63 side={side}
64 sideOffset={sideOffset}
65 className="z-50"
66 >
67 <TooltipPrimitive.Popup
68 data-slot="tooltip-content"
69 render={(popupProps, state) => {
70 const exiting = state.transitionStatus === "ending";
71 const offset = reduceMotion ? {} : slideOffset(state.side);
72 return (
73 <motion.div
74 {...(popupProps as Record<string, unknown>)}
75 {...(props as Record<string, unknown>)}
76 className={cn(
77// … truncated

What it pulls in

npm packages

  • motion
  • @base-ui/react

Other registry items

  • utils
  • springs
  • font-weight

Files it writes

  • src/components/ui/tooltip.tsx

Facts

Registry
trovecn
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-14
Last confirmed
today

Go to the source

trovecn.dev PPRAMANIK62/trovecn on GitHub Raw registry item This item as JSON

More from trovecn

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordiontrovecnComponentsFree3 deps
Agent Activityagent-activitytrovecnComponentsFree2 deps
Approval Requestapproval-requesttrovecnComponentsFree2 deps
ButtonbuttontrovecnComponentsFree2 deps
CheckboxcheckboxtrovecnComponentsFree2 deps
Checkbox Groupcheckbox-grouptrovecnComponentsFree2 deps
ComboboxcomboboxtrovecnComponentsFree3 deps
Comparison Slidercomparison-slidertrovecnComponentsFree1 dep

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex