Components
Tooltip
A short text label shown on hover and keyboard focus.
Client component ("use client")
import.tsx
tooltip-basic.tsx
Edit on GitHubPurpose
Tooltip shows a short, non-essential text label for its trigger on hover and on keyboard focus —
typically for icon-only buttons.
Import
import { Tooltip, TooltipContent, TooltipTrigger } from "@neshel-ui/components";Usage
Preview: tooltip-basic
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
| Prop | Type | Default | Description |
|---|---|---|---|
| delayDuration | number | 700 | The 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
| Prop | Type | Default | Description |
|---|---|---|---|
| ref | Ref<HTMLButtonElement> | — | — |
Also accepts the props of: @radix-ui/react-primitive, React DOM attributes.
TooltipContentProps
| Prop | Type | Default | Description |
|---|---|---|---|
| container | HTMLElement | null | document.body | Portal target (default document.body, wrapped with the trigger's theme). |
| ref | Ref<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-labelon an icon-only button). - Tooltips are not reachable on touch devices without hover: never put essential information or interactive content in them.
Keyboard
| Key | Action |
|---|---|
| Tab | Focus the trigger → shows it |
| Escape | Hide the tooltip |
Common mistakes
- Links or buttons inside a tooltip — use a Popover.