npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

read-more-more

v2.0.2

Published

Read-More-More is a simple package for react that helps to implement 'read more' or 'read less' feature to any given text

Downloads

124

Readme

Read-More-More

Read-More-More is a simple pakage for react that helps to implement 'read more' or 'read less' feature to any given text, you can limit the number of chracters in string/text to give the "read more" text at the end, also if you have a HTML String that you want to convert it to React element, you can do that too by add parseHtml prop

Motivation

I was working on a project where i needed to use "read more/less" button , cause of the huge "HTML String" I was getting from an API and I tried finding libraries to add "read more/less" feature to the text but the problem was that in those libraries there was not any options for parsing HTML string to React element , which was serious need for me.Also I tried parsing the text that i was getting from other 'read more' libraries but that didn't work too. So finally I decided to make my own 'read more/less' library and here we are.

Update 2.0.0

This update brings you a new advance read-more-more, it calculates the actual height of the sentences when it opens, also recalculates the height if the window resizes so it makes the transition smoother. And I named this method AdvReadMoreMore 😬, I know its pretty basic 😂.

Hope you all will love this new update and as always critisims are always welcomed.

How to Use

With React

Read-More-More is extraordinarily simple to use with react. For starters you only have to provide text prop and it's required.

Install

npm install  read-more-more

Import

import {ReadMoreMore, AdvReadMoreMore} from 'read-more-more';

Use

<ReadMoreMore text={yourTextHere} /> or <AdvReadMoreMore text={yourTextHere} /> , add other props according to your needs

| Props | type | Default Value | Defination | | :-----------: | :-----: | :-----------: | :----------------------------------------------------: | | text | string | null | add the text you want to "read more/less" to it | | checkFor | number | 300 np | how many characters it should check to add "read more" | | btnStyles | object | null | pass custom styles to "read more/less" button | | transDuration | number | 2s | transition duration for the read more/less collapsing | | transType | string | linear | transition type for the read more/less collapsing | | linesToShow | number | 3 | intial number of lines to show | | parseHtml | boolean | false | to parse html string to react element | | readMoreText | string | read more... | replace the default "read more..." with your own text | | readLessText | string | read less... | replace the default "read less..." with your own text | | textStyles | object | null | styles the text container along with the text |

Addition props for AdvReadMoreMore

| Props | type | Default Value | Defination | | :-----------: | :-----: | :-----------: | :----------------------------------------------------: | |lineHeight|number| 20 (i.e. 20px)|line height of the text| |fontSize | number | 15 (i.e.15px)| font size of the text| |color|string|#000| color of the text|

Note : textStyles prop is not suppported in AdvReadMoreMore

Demo

Click here

Report Bugs

Report

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.