Experience System
Components

Tooltip

Contextual hints on hover or focus, with directional placement including leading and trailing sides.

Installation

The components are exported from @by/experience-system. Add the package with your package manager:

pnpm add @by/experience-system

In this monorepo, depend on the workspace package (for example via workspace:* or your catalog) so imports resolve to packages/experience-system.

Composition

Wrap tooltips in TooltipProvider, then compose Tooltip, TooltipTrigger, and TooltipContent:

TooltipProvider
└── Tooltip
    ├── TooltipTrigger
    └── TooltipContent
        └── TooltipArrow (rendered by Experience System Content)

Use TooltipTrigger asChild so the trigger stays a real Button or focusable control. Content is portaled to the ThemeProvider container when configured. See Radix Tooltip.

Usage

import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
  Button,
} from '@by/experience-system';

TooltipProvider, Tooltip, TooltipTrigger, and TooltipContent are client components ('use client'). Use them inside a Client Component or a dynamic import when using the Next.js App Router.

<TooltipProvider>
  <Tooltip>
    <TooltipTrigger asChild>
      <Button variant="outline">Save</Button>
    </TooltipTrigger>
    <TooltipContent side="top">Save your changes</TooltipContent>
  </Tooltip>
</TooltipProvider>

Examples

Overview

Placements top, bottom, leading, and trailing around a frame (leading / trailing follow ThemeProvider direction).

Ellipsis with tooltip

Single-line, multi-line, and non-truncated cases using the registry TooltipEllipsisRecipe (wrapped in TooltipProvider).

Single-line truncation

Shipment ETA has been updated with additional fulfillment details for the destination warehouse.

Multi-line truncation

This recipe combines CSS line clamping with runtime overflow detection so the tooltip only appears when the rendered content is actually truncated inside its container.

No tooltip when text fits

Short helper text that fits in the container.

API Reference

TooltipProvider, Tooltip, TooltipTrigger, and TooltipContent map to Radix Tooltip parts. The tables for Provider, Root, Trigger, Portal, Content, and Arrow follow Radix Tooltip. TooltipContent extends side with leading and trailing, resolved via ThemeProvider direction. The Experience System TooltipProvider sets delayDuration={300} and skipDelayDuration={100} before ...props, so callers can override.

TooltipProvider

PropTypeDefault
delayDurationnumber300 (then Radix / caller override via ...props)
skipDelayDurationnumber100
disableHoverableContentboolean

Tooltip

PropTypeDefault
defaultOpenboolean
openboolean
onOpenChange(open: boolean) => void
delayDurationnumber
disableHoverableContentboolean
Data attributeValues
data-slottooltip

TooltipTrigger

PropTypeDefault
asChildbooleanfalse
Data attributeValues
data-slottooltip-trigger
data-stateclosed | delayed-open | instant-open

TooltipContent

PropTypeDefault
asChildbooleanfalse
sidetop | right | bottom | left | leading | trailingtop
alignstart | center | endcenter
sideOffsetnumber4
alignOffsetnumber0
aria-labelstring
onEscapeKeyDown(event: KeyboardEvent) => void
onPointerDownOutside(event: PointerDownOutsideEvent) => void
forceMountboolean
avoidCollisionsbooleantrue
collisionBoundaryBoundary[]
collisionPaddingnumber | Padding0
arrowPaddingnumber0
stickypartial | alwayspartial
hideWhenDetachedbooleanfalse
Data attributeValues
data-slottooltip-content
data-stateclosed | delayed-open | instant-open
data-sideleft | right | bottom | top
data-alignstart | end | center
CSS variableDescription
--radix-tooltip-content-transform-originComputed transform origin for content and arrow
--radix-tooltip-content-available-widthRemaining width between trigger and boundary
--radix-tooltip-content-available-heightRemaining height between trigger and boundary
--radix-tooltip-trigger-widthTrigger width
--radix-tooltip-trigger-heightTrigger height

Accessibility

Keep tooltip text short; avoid essential information only in a tooltip. Prefer visible labels and aria-describedby for critical help. TooltipTrigger asChild preserves the child control’s role and focus behavior. See Radix Tooltip — accessibility.

Keyboard interactions

KeyDescription
TabOpens or closes the tooltip without delay when moving focus.
SpaceIf open, closes the tooltip without delay.
EnterIf open, closes the tooltip without delay.
EscapeIf open, closes the tooltip.

Source in the repo: packages/experience-system/src/components/Tooltip/Tooltip.tsx. Agent-oriented contracts: packages/experience-system/src/components/Tooltip/Tooltip.instructions.md.

Registry examples

This @by-es item is a registry-only composite — live preview, installation steps, and source live on the dedicated page. See Registry for components.json setup and REGISTRY_TOKEN.

Ellipsis with tooltip

Truncated text with an overflow-only tooltip using Tooltip from @by/experience-system.

→ See /system/components/ellipsis-with-tooltip.