Skip to content

UI: Tooltip

View as Markdown

A short text next to its trigger, with TooltipTrigger. Import the token file once (@pithyx/ui/tokens.css) and wrap the app in UiProvider; see @pithyx/ui.

Generated from the TSDoc comments of @pithyx/ui 1.0.0-rc.9 at build time; the text below the headings is the comment in the source.

The props of Tooltip.

  • Omit<AriaTooltipProps, "className">
optional className?: string;

Extra class names, added after the tooltip’s own.

const TooltipTrigger: (props) => Element = AriaTooltipTrigger;

Shows a Tooltip for its first child on hover and keyboard focus. It is React Aria’s TooltipTrigger; its props (delay, closeDelay, isDisabled) are documented there.

TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip relative to the trigger.

Parameter Type
props TooltipTriggerComponentProps

Element

props

React Aria’s tooltip trigger props, the trigger and the tooltip.

The trigger with its tooltip.

function Tooltip(props): Element;

A short text next to its trigger; wrap both in a TooltipTrigger. A tooltip shows on hover and keyboard focus, never on touch, so it must not carry anything the user needs.

Parameter Type Description
props TooltipProps React Aria’s tooltip props (placement, offset) and the text.

Element

The tooltip.

<TooltipTrigger>
<Button>Sync</Button>
<Tooltip>Last synced 5 minutes ago</Tooltip>
</TooltipTrigger>