React-ellipsis-component Docs
English Docs
IntroductionInstallGetting StartedNormal EllipsisCustom Ellipsis CharCustom Ellipsis NodeFlexible EllipsisFilter End CharRich textshow n lines when more than m linesAPI
中文文档

Getting Started

import Ellipsis from 'react-ellipsis-component';

⚠️ The browsers have different style with normal `line-height`, that may make an ellipsis error. To avoid that, set a certain line-height for component is better.

Tips: You can custom styles of component by using className prop.

Normal Ellipsis

Normal ellipsis base on css property -webkit-line-clamp, best performance and support flexible ellipsis natively.

Custom Ellipsis Char

Custom Ellipsis Node

Flexible Ellipsis

Normal Ellipsis support flexible ellipsis default. Should open by yourself when use more feature.

Filter End Char

Rich text

You can use rich text by setting dangerouslyUseInnerHTML=true.

Recommended to use maxHeight instead of maxLine when use rich text. Some child element in rich text may have different line-height from container which will lead to compute maxLine error.

Warning⚠️: make sure the text that you pass is safe absolutely, or you may been attacked by XSS.

show n lines when more than m lines

show all content lines if the count of content line small than maxLine, or show visibleLine line of content.

You can refer to API Docs for more features.