Socket
Socket
Sign inDemoInstall

react-tag-cloud

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tag-cloud

Create beautiful tag/word clouds using React


Version published
Weekly downloads
650
decreased by-27.37%
Maintainers
1
Weekly downloads
 
Created
Source

react-tag-cloud ☁️

Create beautiful tag/word clouds using React. Uses the wonderful d3-cloud under the hood.

react-tag-cloud-image

View live demo here (fullscreen)

Installation

npm install react-tag-cloud
or
yarn add react-tag-cloud

Usage

import TagCloud from 'react-tag-cloud';
import randomColor from 'randomcolor';

class MyCloud extends Component {
  render() {
    return (
      <TagCloud 
        style={{
          fontFamily: 'sans-serif',
          fontSize: 30,
          fontWeight: 'bold',
          fontStyle: 'italic',
          color: () => randomColor(),
          padding: 5,
          width: '100%',
          height: '100%'
        }}>
        <div style={{fontSize: 50}}>react</div>
        <div style={{color: 'green'}}>tag</div>
        <div rotate={90}>cloud</div>
        ...
      </TagCloud>
    );
  }
}

Documentation

<TagCloud> props:

namedescriptiontypedefault
style.fontSizeFont size needed for calculating layoutFunction/Number20
style.fontFamilyFont family needed for calculating layoutFunction/Stringserif
style.fontWeightFont weight needed for calculating layoutFunction/Numbernormal
style.fontStyleFont style needed for calculating layoutFunction/Stringnormal
style.paddingPadding between tags (px)Function/Number1
style.colorColor to be used by tagsFunction/String(none)
rotateRotation in degreesFunction/Number0
spiralSpiralFunction/Stringarchimedean
randomRandomizer functionFunctionMath.random

Any component can be used as a child component. TagCloud scans the child components for the following props for its layout calculation:

namedescriptiontypedefault
style.fontSizeFont size needed for calculating layoutFunction/Number20
style.fontFamilyFont family needed for calculating layoutFunction/Stringserif
style.fontWeightFont weight needed for calculating layoutFunction/Numbernormal
style.fontStyleFont style needed for calculating layoutFunction/Stringnormal
style.paddingPadding between tags (px)Function/Number1
style.colorColor to be used by tagFunction/String(none)
rotateRotation in degreesFunction/Number0

Examples

Resources

License

MIT

Keywords

FAQs

Package last updated on 10 Sep 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc