
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
react-show-more
Advanced tools
React component for truncating multi-line spans and adding an ellipsis
This is a convenience wrapper around react-truncate.
$ npm install react-show-more
import ShowMore from 'react-show-more';
// ...
class Foo extends Component {
render() {
return (
<ShowMore
{* Default options *}
lines={3}
more='Show more'
less='Show less'
anchorClass=''
>
{longText}
</ShowMore>
);
}
}
Prop | Type | Default | Description | Example |
---|---|---|---|---|
lines | integer, boolean {false} | 3 | Specifies how many lines of text should be preserved until it gets truncated. false and any integer < 1 will result in the text not getting clipped at all. | (false , -1 , 0 ), 1 , ... |
children | string, React node | The text to be truncated. Anything that can be evaluated as text. | 'Some text' , <p>Some paragraph <a/>with other text-based inline elements<a></p> , <span>Some</span><span>siblings</span> | |
more | string, React node | 'Show more' | The text to display in the anchor element to show more. | 'Show more' , <span>Show more</span> |
less | string, React node | 'Show less' | The text to display in the anchor element to show less. | 'Show less' , <span>Show less</span> |
anchorClass | string | '' | Class name(s) to add to the anchor elements. | 'my-anchor-class' , 'class-1 class-2' |
Install development dependencies
$ npm install
Run tests
$ npm test
Run code linter
$ npm run lint
Compile to ES5 from /src to /lib
$ npm run compile
FAQs
React component for truncating multi-line spans and adding an ellipsis
The npm package react-show-more receives a total of 4,616 weekly downloads. As such, react-show-more popularity was classified as popular.
We found that react-show-more demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.