Skip to Content
Neshel-UI
Components

Tooltip

A short text label shown on hover and keyboard focus.

Client component ("use client")

Purpose

Tooltip shows a short, non-essential text label for its trigger on hover and on keyboard focus — typically for icon-only buttons.

Import

import.tsx
import { Tooltip, TooltipContent, TooltipTrigger } from "@neshel-ui/components";

Usage

Preview: tooltip-basic
Preview theme
tooltip-basic.tsx
import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@neshel-ui/components";
import { Inline } from "@neshel-ui/layout";
import { Copy, Trash2 } from "lucide-react";

export default function TooltipBasic() {
  return (
    <Inline space="2">
      <Tooltip>
        <TooltipTrigger asChild>
          <Button iconOnly variant="ghost" aria-label="Copy link">
            <Copy aria-hidden="true" />
          </Button>
        </TooltipTrigger>
        <TooltipContent>Copy link</TooltipContent>
      </Tooltip>
      <Tooltip delayDuration={0}>
        <TooltipTrigger asChild>
          <Button iconOnly variant="ghost" aria-label="Delete">
            <Trash2 aria-hidden="true" />
          </Button>
        </TooltipTrigger>
        <TooltipContent side="bottom">Delete (no delay)</TooltipContent>
      </Tooltip>
    </Inline>
  );
}

API

TooltipProps

TooltipProps
PropTypeDefaultDescription
delayDurationnumber700The duration from when the pointer enters the trigger until the tooltip gets opened. This will override the prop with the same name passed to Provider. Hover delay in ms (default 300).

Also accepts the props of: @radix-ui/react-tooltip.

TooltipTriggerProps

TooltipTriggerProps
PropTypeDefaultDescription
refRef<HTMLButtonElement>——

Also accepts the props of: @radix-ui/react-primitive, React DOM attributes.

TooltipContentProps

TooltipContentProps
PropTypeDefaultDescription
containerHTMLElement | nulldocument.bodyPortal target (default document.body, wrapped with the trigger's theme).
refRef<HTMLDivElement>——

Also accepts the props of: @radix-ui/react-popper, @radix-ui/react-primitive, @radix-ui/react-tooltip, React DOM attributes.

A provider is included per tooltip; no application-level provider is required. delayDuration controls the hover delay.

Accessibility

  • The tooltip text describes the trigger; the trigger still needs its own accessible name (aria-label on an icon-only button).
  • Tooltips are not reachable on touch devices without hover: never put essential information or interactive content in them.

Keyboard

KeyAction
TabFocus the trigger → shows it
EscapeHide the tooltip

Common mistakes

  • Links or buttons inside a tooltip — use a Popover.
Edit on GitHub

On this page