Skip to main content
OverflowingTextWithTooltip truncates content within the available width. It checks for overflow on pointer entry and focus, then shows a tooltip only when needed. It manages tooltip visibility internally and exposes no controlled or uncontrolled open-state props.

Usage

Constrain the width of the surrounding layout so truncation can occur. isFocusable gives the text a tab stop and opens the tooltip on focus or click. Keep essential information available to users who cannot hover.

Multiline content

displayedMaxRows limits the displayed lines; use a positive integer. isTooltipMultiline preserves whitespace and line breaks inside the tooltip. Without a row limit, text truncates on one line.

Custom content and timing

React content requires a plain-string tooltipContent. With string text, that prop can override the tooltip label; otherwise the text itself is used. An empty or missing label does not open a tooltip. String text also recognizes links. alwaysShowTooltip allows the tooltip even without truncation. tooltipDelay controls the hover delay and defaults to 500 milliseconds. tooltipPlace defaults to bottom. The component supplies its text and tooltip parts internally; it does not accept children, native attributes, or a ref for its text element. Use Text and Tooltip directly when you need custom composition. Interactive popup content belongs in Popover.

Props

boolean
Allows the tooltip even when the text is not truncated.
number
Maximum displayed rows. Omit for single-line truncation; use a positive integer for multiline text.
boolean
Adds a tab stop and opens the tooltip on focus or click.
boolean
Preserves whitespace and line breaks in the tooltip.
"large" | "small"
Small inherited text sizing or the large fixed-height treatment.
string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...> | null | undefined
required
Text or React content to truncate. Non-string React content requires tooltipContent.
string
Plain text displayed in the tooltip. Defaults to text when it is a nonempty string.
number
Hover delay in milliseconds.
"bottom" | "left" | "right" | "top"
Preferred side of the tooltip.