Package Exports
- lad-react-multiline-ellipsis
Readme
ðĶ react-multiline-ellipsis-text
A lightweight and reusable React component for applying multi-line ellipsis to text â ideal for truncating long descriptions, titles, or notes with a clean UI.
âĻ Default is 2-line truncation, but customizable to any number of lines.
ð§ Installation
npm install react-multiline-ellipsis-text
or with yarn:
yarn add react-multiline-ellipsis-text
ð Usage
import React from 'react';
import { EllipsisText } from 'react-multiline-ellipsis-text';
function App() {
return (
<div style={{ width: 300 }}>
<EllipsisText
text="This is a long piece of text that will be truncated after two lines with an ellipsis to indicate more content."
lines={2}
/>
</div>
);
}
ð§Đ Props
Prop Type Default Description
text string â The text content to display.
lines number 2 The number of lines to show before truncating.
style object {} Optional styles to override the default component.
className string "" Optional class name for additional styling.
ðĄ Why use this?
â
Handles long text elegantly in cards, lists, etc.
ðŠķ Tiny and dependency-free (except react)
âïļ Fully customizable via style or className
ð Works great in responsive layouts
ð License
MIT License ÂĐ Raj Lad