Overlays
Tooltip
Dark 12 Medium bubble, radius 8, raised shadow. One line, no arrow.
react-aria-components
Preview
"use client";
import { RefreshCw } from "lucide-react";
import { IconButton } from "@/components/ui/icon-button";
import { Tooltip, TooltipTrigger } from "@/components/ui/tooltip";
export default function Example() {
return (
<TooltipTrigger delay={300}>
<IconButton aria-label="Refresh score"><RefreshCw /></IconButton>
<Tooltip>Score updated 2h ago</Tooltip>
</TooltipTrigger>
);
}Installation
Components are copied into your project — no runtime package.
Install the following dependencies:
terminalnpm install react-aria-componentsCreate a
tooltip.tsxfile and paste the following code into it.src/components/ui/tooltip.tsx"use client"; import type { ReactNode } from "react"; import { Tooltip as AriaTooltip, TooltipTrigger, type TooltipProps as AriaTooltipProps } from "react-aria-components"; import { cx } from "@/utils/cx"; export { TooltipTrigger }; /** Dark 12 Medium bubble, radius 8, raised shadow. One line, no arrow. */ export function Tooltip({ className, children, ...props }: Omit<AriaTooltipProps, "className" | "children"> & { className?: string; children: ReactNode }) { return ( <AriaTooltip offset={6} {...props} className={cx( "rounded-sm bg-inverse px-2 py-1.5 text-sm font-medium text-fg-inverse shadow-[0_4px_12px_rgb(0_0_0/0.16)]", className, )} > {children} </AriaTooltip> ); }Add the theme tokens and the
cxhelper from Installation if you haven’t yet, then update the import paths to match your project setup.