Truncate
Leave feedbackA Truncate component can help you crop multiline text. There will be three dots at the end of the text.
Basic Usage
Any Paragon component or export may be added to the code example.
With the custom ellipsis
Any Paragon component or export may be added to the code example.
With the onTruncate
Any Paragon component or export may be added to the code example.
Example usage in Card
Any Paragon component or export may be added to the code example.
HTML markdown support
Note: Truncate supports only plain HTML children and not jsx.
Any Paragon component or export may be added to the code example.
Props API#
- children
stringRequiredThe expected text to which the ellipsis would be applied.
- lines
string|numberDefault1The number of lines the text to be truncated to.
- ellipsis
string|number|nodeDefault'...'Text content for the ellipsis - will appear after the truncated lines.
- whiteSpace
boolDefaultfalseAdds the whitespace from before the ellipsis.
- elementType
stringDefault'div'Custom html element for truncated text.
- className
stringSpecifies class name to append to the base element.
- onTruncate
funcCallback fired when a text truncating
Usage Insights#
Truncate
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-discussions | 20.44.0 | 1 | |
| frontend-app-learner-dashboard | 20.32.0 | 3 | |
| frontend-lib-content-components | 20.45.0 | 1 |