H
Harukit UIDocumentation
Components

Tooltip

A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Installation

bunx --bun harukit@latest add tooltip
npx harukit@latest add tooltip
pnpm dlx harukit@latest add tooltip
yarn harukit@latest add tooltip

Example

"use client";

import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";

export function TooltipDemo() {
  return (
    <div className="flex items-center justify-center h-40">
      <Tooltip>
        <TooltipTrigger>
          <button className="px-4 bg-yellow-500 text-white rounded-md hover:bg-yellow-600">
            Hover me
          </button>
        </TooltipTrigger>
        <TooltipContent side="top">
          This is a tooltip message!
        </TooltipContent>
      </Tooltip>
    </div>
  );
}

API Reference

Tooltip

PropTypeDefaultDescription
childrenReact.ReactNode-The content inside the Tooltip (usually TooltipTrigger + TooltipContent).

TooltipTrigger

PropTypeDefaultDescription
childrenReact.ReactNode-The element that triggers the tooltip (hover/focus).
refReact.Ref<HTMLSpanElement>-Optional ref to the trigger element.
...propsReact.HTMLAttributes<HTMLSpanElement>-Any additional HTML attributes for the trigger element.

TooltipContent

PropTypeDefaultDescription
childrenReact.ReactNode-The content displayed inside the tooltip.
side"top" | "bottom" | "left" | "right""top"The preferred side where the tooltip appears relative to the trigger.
sideOffsetnumber6Distance (in px) between the tooltip and the trigger element.
classNamestring-Additional CSS classes to customize the tooltip styling.

TooltipProvider

PropTypeDefaultDescription
childrenReact.ReactNode-Wrap your tooltip components inside this provider to share context.