
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
react-wordcloud
Advanced tools
Simple React + D3 wordcloud component with powerful features. Uses the d3-cloud
layout.
npm install react-wordcloud
Note that react-wordcloud
requires react^16.13.0
as a peer dependency.
import React from 'react';
import ReactWordcloud from 'react-wordcloud';
const words = [
{
text: 'told',
value: 64,
},
{
text: 'mistake',
value: 11,
},
{
text: 'thought',
value: 16,
},
{
text: 'bad',
value: 17,
},
]
function SimpleWordcloud() {
return <ReactWordcloud words={words} />
}
An example showing various features (callbacks, options, size).
const callbacks = {
getWordColor: word => word.value > 50 ? "blue" : "red",
onWordClick: console.log,
onWordMouseOver: console.log,
getWordTooltip: word => `${word.text} (${word.value}) [${word.value > 50 ? "good" : "bad"}]`,
}
const options = {
rotations: 2,
rotationAngles: [-90, 0],
};
const size = [600, 400];
const words = [...];
function MyWordcloud() {
return (
<ReactWordcloud
callbacks={callbacks}
options={options}
size={size}
words={words}
/>
);
}
View all documented examples and gallery of react-wordcloud
applications at https://react-wordcloud.netlify.com/.
You can also run the examples locally:
git clone git@github.com:chrisrzhou/react-wordcloud
cd react-wordcloud
npm install && npm run docs
Create wordclouds using this wordcloud generator: https://wordcloud-generator.netlify.com/
Features supported:
The code is written in typescript
, linted with xo
, and built with microbundle
. Examples and documentations are built with docz
.
Feel free to contribute by submitting a pull request.
1.2.7 (2020-08-07)
Decoupled the tippy
CSS from the package. This will improve future versioning of the project, and is also the recommendation set by the tippy
project. Tooltips with this new versions might look off without CSS styles, but not considering this a breaking change because you can easily add the following imports to address the issue:
import 'tippy.js/dist/tippy.css';
import 'tippy.js/animations/scale.css'
Some rarely used typings are no longer exported (e.g. Enter
, Spiral
, WordToStringCallback
, WordEventCallback
, MinMaxPair
, AttributeValue
). While this is a breaking change, taking the liberty to assume this as non-breaking in an effort to constrain the exposed typings for improved future versioning of the project.
FAQs
Simple React + D3 wordcloud component with powerful features.
The npm package react-wordcloud receives a total of 12,457 weekly downloads. As such, react-wordcloud popularity was classified as popular.
We found that react-wordcloud 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.