A component that handles text truncation with an accessible tooltip that appears only when the text is actually truncated.
The component can be imported via:
The Truncated component is designed to handle text that might be too long for its container. It intelligently displays a tooltip only when text is actually truncated, providing a clean user experience.
When text fits within the container, no tooltip will appear on hover:
You can control where the tooltip appears relative to the text using the tooltipPlacement prop:
By default, the tooltip will display the same content as the component's children. You can override this behavior with the tooltip prop:
This is particularly useful when your content includes links or formatting that shouldn't be duplicated in the tooltip:
tooltip prop is optional - if not provided, the component will use its children as the tooltip contenttooltip prop when your content includes elements that shouldn't be duplicated in the tooltip (like links or special formatting)PlumaTruncated extends TextThe text color. (See text color tokens)
The font family. (See font family tokens)
The font style. (See MDN font-style)
The text size. (See font size tokens)
A predefined typography style. (See text tokens)
The text to be shown when the text is truncated.
Default:'bottom'
Where the tooltip should be placed in relation to the text.