Componentfeedback0.92 KB gzipZero dependencies

Tooltip

Floating helper tooltip on hover and keyboard focus.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add tooltip

Or install the full npm package:

npm install bigbullui

Usage

tsx5 lines
import { Tooltip } from "@/components/ui/tooltip"; <Tooltip content="Helpful text">  <Button variant="outline">Hover me</Button></Tooltip>

Source code

tooltip.tsx + 4 helpers

Zero 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 />
PropTypeDescription
contentReact.ReactNodeTooltip text or content.
side"top" | "bottom" | "left" | "right"Placement of the tooltip.
delayMsnumberDelay before showing (default 300).
animatedbooleanDual-mode: false renders instantly with no motion. Default true.