Componentfeedback0.92 KB gzipZero dependencies
Tooltip
Floating helper tooltip on hover and keyboard focus.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add tooltipOr install the full npm package:
npm install bigbulluiUsage
tsx5 lines
import { Tooltip } from "@/components/ui/tooltip"; <Tooltip content="Helpful text"> <Button variant="outline">Hover me</Button></Tooltip>Source code
tooltip.tsx + 4 helpersZero third-party dependencies (5 local files shown in tabs below).
tsxtooltip.tsx125 lines
"use client"; import * as React from "react";import { createPortal } from "react-dom";import { cn } from "./lib/utils";import { registerEscapeLayer } from "./lib/focus-trap";import { useIsMounted } from "./lib/react-compat";import { useFloating } from "./lib/floating"; export type TooltipProps = Omit<React.HTMLAttributes<HTMLSpanElement>, "content"> & { content: React.ReactNode; side?: "top" | "bottom" | "left" | "right"; delayMs?: number; /** Dual-mode: false renders instantly with no motion. Default true. */ animated?: boolean;}; export function Tooltip({Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Tooltip } from "@/components/ui/tooltip"; <Tooltip />| Prop | Type | Description |
|---|---|---|
| content | React.ReactNode | Tooltip text or content. |
| side | "top" | "bottom" | "left" | "right" | Placement of the tooltip. |
| delayMs | number | Delay before showing (default 300). |
| animated | boolean | Dual-mode: false renders instantly with no motion. Default true. |