Truncated clips longer text with an ellipsis and provides an accessible tooltip that displays on truncation.
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 TextDefault:'span'
What element or component should be rendered.
The text to be shown when the text is truncated.
Default:'bottom'
Where the tooltip should be placed in relation to the text.