Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-simple-show-more
Advanced tools
Demo: https://elated-curran-7104e4.netlify.com/
Very simple and lightweight Show More
feature.
It is in alpha testing. Please make an issue if you have any suggestion or feature request.
npm i react-simple-show-more
Very simple Show more feature.
This package guarantees you not to collapse in middle of the word.
For example: with length 23
= "I just want to say Hello" => "I just want to say" (not "I just want to say Hell")
Super easy to use:
import ShowMore from "react-simple-show-more"
class YourComponent extends Component {
render() {
return (
<ShowMore
text="Very long text"
/>
);
}
}
You can also configure it as your demand:
import ShowMore from "react-simple-show-more"
class YourComponent extends Component {
render() {
return (
<ShowMore
text="Very long text"
length={170}
showMoreLabel=" Expand"
showLessLabel=" Collapse"
tag="a"
className="text-blue"
ellipsis="..."
style={{
cursor: 'pointer',
color: 'green',
fontWeight: 'bold',
}}
enabled
/>
);
}
}
You can see demo via this https://elated-curran-7104e4.netlify.com/
Parameter | value | is required | default |
---|---|---|---|
text | string | yes | |
length | string, number | no | 170 |
showMoreLabel | string | no | 'Show more' |
showLessLabel | string | no | 'Show less' |
tag | string | no | 'span' |
className | string | no | '' |
ellipsis | string | no | '...' |
style | object | no | default Style |
enabled | boolean | no | true |
defaultStyle = {
cursor: 'pointer',
color: '#007bff',
}
All helps are welcome. Please open a PR and describe what do you want to improve.
Please create an issue at https://github.com/nvh95/react-simple-show-more/issues. I will spend time to help you.
FAQs
Simple Show More Component for React
We found that react-simple-show-more demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.