Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-dotdotdot
Advanced tools
Cross-browser multiline text ellipsis for react
Inspired by: https://github.com/BeSite/jQuery.dotdotdot
Internally uses: https://www.npmjs.com/package/clamp-js
npm install --save react-dotdotdot
import React from 'react'
import Dotdotdot from 'react-dotdotdot'
...
render() {
return (
<div>
<Dotdotdot clamp={3}>
<p>
Long, long <br />
content,<br />
3 lines <br />
will be shown.
</p>
</Dotdotdot>
</div>
)
}
clamp (Number | String | 'auto'). This controls where and when to clamp the text of an element. Submitting a number controls the number of lines that should be displayed. Second, you can submit a CSS value (in px or em) that controls the height of the element as a String. Finally, you can submit the word 'auto' as a string. Auto will try to fill up the available space with the content and then automatically clamp once content no longer fits. This last option should only be set if a static height is being set on the element elsewhere (such as through CSS) otherwise no clamping will be done.
useNativeClamp: [default: true
] Use -webkit-line-clamp available in Webkit (Chrome, Safari) only.
splitOnChars: [default: ['.', '-', '–', '—', ' ']
] Split on sentences (periods), hypens, en-dashes, em-dashes, and words (spaces).
animate: [default: false] animated clamp
truncationChar: The character to insert at the end of the HTML element after truncation is performed. This defaults to an ellipsis (…).
useNativeClamp
overrides it to default.
truncationHTML: String of HTML to use instead of truncationChar
tagName: [default: div
] (String). The type of HTML tag which will wrap the component's content.
React-dotdotdot is simple plugin, if you need more functionality, consider using react-truncate https://www.npmjs.com/package/react-truncate
padding-bottom
CSS rule breaks clampline-height
units might be important for React-dotdotdot. We recommend px
over em
1.3.1
1.3.0
useNativeClamp
prop is set to false by default, it was causing some issues.potential security vulnerability
with react-dom
1.2.4
1.2.3
div
(thanks @Kalita-Roman).npmignore
to limit package size1.2.2
1.2.1
1.2.0
1.0.17
1.0.16
TypeError: elem.lastChild is null
in Firefox.FAQs
Multiline text ellipsis for react
The npm package react-dotdotdot receives a total of 24,940 weekly downloads. As such, react-dotdotdot popularity was classified as popular.
We found that react-dotdotdot 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.