GitHub

Tooltip

Small popup with helpful text on hover

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { Tooltip } from "@corew500/ui/tooltip"

<Tooltip>Content</Tooltip>

CMS Integration

CMSPayload CMS Integration
This component supports CMS-driven content via @corew500/cms-payload.
Loading...

API Reference

Props

PropTypeDefaultDescription
defaultOpenenumfalseWhether the tooltip is initially open. To render a controlled tooltip, use the `open` prop instead.
openenumWhether the tooltip is currently open.
onOpenChange(open: boolean, eventDetails: TooltipRootChangeEventDetails) => voidEvent handler called when the tooltip is opened or closed.
onOpenChangeComplete(open: boolean) => voidEvent handler called after any animations complete when the tooltip is opened or closed.
disableHoverablePopupenumfalseWhether the tooltip contents can be hovered without closing the tooltip.
trackCursorAxisenum'none'Determines which axis the tooltip should track the cursor on.
actionsRefRefObject<TooltipRootActions>A ref to imperative actions. - `unmount`: Unmounts the tooltip popup. - `close`: Closes the tooltip imperatively when called.
disabledenumfalseWhether the tooltip is disabled.
handleTooltipHandle<unknown>A handle to associate the tooltip with a trigger. If specified, allows external triggers to control the tooltip's open state. Can be created with the Tooltip.createHandle() method.
triggerIdstringID of the trigger that the tooltip is associated with. This is useful in conjunction with the `open` prop to create a controlled tooltip. There's no need to specify this prop when the tooltip is uncontrolled (i.e. when the `open` prop is not set).
defaultTriggerIdstringID of the trigger that the tooltip is associated with. This is useful in conjunction with the `defaultOpen` prop to create an initially open tooltip.

Accessibility

Focus Management

  • Manages focus and hover states across tooltip group

Screen Readers

  • - Coordinates ARIA relationships for all child tooltips

Localization

Translatable Content

  • - All TooltipContent children should be pre-translated text
  • Tooltip text should be brief and descriptive

Additional

  • Avoid complex markup inside tooltips for better screen reader compatibility