2.1.2 • Published 2 years ago

react-row-ellipsis v2.1.2

Weekly downloads
-
License
MTI
Repository
github
Last release
2 years ago

📄 Description

Simple easy to use React component which allow you to truncate a text with line indication. You can truncate not only simple string but also any elements/tags inside the component. Lines amount are configurable and works based on container or screen size. So you don't have to worry about different screen sizes. Lines amount will stay exactly the same.

📦 Installation

Just run the following command at the root of your project:

npm install react-row-ellipsis
# or
yarn add react-row-ellipsis

✨ Demo

Feel free to check the demo where you can test different settings for the component:

Edit Demo for react-row-ellipsis

🚀 Usage

Just import the component and you are good to go

import { Ellipsis } from 'react-row-ellipsis'
<Ellipsis lines={3}>
  The long text goes here
</Ellipsis>

🌉 Examples

Basic example. Truncate simple string:

<Ellipsis lines={2}>
  Lorem ipsum dolor sit amet consectetur adipisicing elit.
  Cum quidem dolorum sapiente, incidunt perferendis praesentium.
</Ellipsis>

Example with the tags inside. You can use different tags but you want to use inline tags:

<Ellipsis lines={1}>
  <strog>Lorem, ipsum dolor.</strong>
  <span>Lorem ipsum dolor sit <a href="#">amet</a> consectetur adipisicing elit.</span>
</Ellipsis>

Example with another tag. The text will be rendered in the <div> tag:

<Ellipsis lines={3} as="div">
  Lorem, ipsum dolor sit amet consectetur adipisicing elit.
  Soluta eum, quaerat quidem unde deserunt harum sint ex cum.
</Ellipsis>

🛠 Props

PropsTypeDefaultDescription
linesnumber1Set amount of lines to display
asstringpSet render tag

🤝 Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

📝 License

This project is MIT licensed.

2.1.2

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago