Simple and Extensible Tag/Word Cloud React Component

Simple and Extensible Tag/Word Cloud React Component

react-tagcloud. Simple and extensible tag/word cloud React component. Tag/word cloud component for react


Simple and extensible tag/word cloud React component.

See the demo.

preview tag-cloud preview


npm install react-tagcloud

# or with yarn
yarn install react-tagcloud

# react < 16.8.0
npm install [email protected]

Basic usage

import { TagCloud } from 'react-tagcloud'

const data = [
  { value: 'JavaScript', count: 38 },
  { value: 'React', count: 30 },
  { value: 'Nodejs', count: 28 },
  { value: 'Express.js', count: 25 },
  { value: 'HTML5', count: 33 },
  { value: 'MongoDB', count: 18 },
  { value: 'CSS3', count: 20 },

const SimpleCloud () => (
    onClick={tag => alert(`'${tag.value}' was selected!`)}



<TagCloud /> component has props listed below:

Option Type Required Note
tags Array true Array of objects that represent tags
maxSize Number true Maximal font size (in px) used in cloud
minSize Number true Minimal font size (in px) used in cloud
shuffle Boolean false If true, tags are shuffled. When tags are modified, cloud is re-shuffled. Default: true
randomNumberGenerator Function false Specifies a custom random number generator that is being used by shuffle algorithm. Default: Math.random
colorOptions Object false Random color options
disableRandomColor Boolean false If true, random color is not used
renderer Function false Function used to render tag

Note: Furthermore you can pass any other prop and it will be forwarded to the wrapping <div /> component (e.g. style, className).

Tag object

Each tag is represented by object literal having following properties:

Property Type Required Note
value String true String value to be displayed
count Number true Represents frequency of the tag that is used to calculate tag size
key String false Tag element key. If it is not provided, value property will be used instead (however it can fail if you don't have unique tag values. It is highly recommeded to use key property)
color String false Represents color of the tag. If it is not provided, random color will be used instead
props Object false Props to be passed to a particular tag component


Event handlers can be passed to the <TagCloud /> props. Each handler has two arguments: the first is related tag object and the second is DOM event object.

Currently supported events: onClick, onDoubleClick, onMouseMove

Note: Feel free to open issue if any other event is needed.


Default class names are tag-cloud for the wrapping container, and tag-cloud-tag for a particular tag. Styles passed to <TagCloud /> props will be applied to the wrapping container.


Rendering of tags can be fully customized by providing custom render function and passing it to the renderer prop. By default is used defaultRenderer. Render function has three arguments - tag, size and color. For example:

import { TagCloud } from 'react-tagcloud'

const customRenderer = (tag, size, color) => {
  return (
    <span key={tag.value} style={{ color }} className={`tag-${size}`}>

const CustomizedCloud () => (
  <TagCloud tags={data} minSize={1} maxSize={5} renderer={customRenderer} />

More examples


Install dev modules:

yarn install

Run unit tests

yarn test

Run examples

cd examples
yarn install
yarn start

and open browser at http://localhost:3000

Download Details:

Author: madox2 Live Demo: Download Link: Download The Source Code Official Website: License: MIT License

react javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

How to Select and Hire the Best React JS and React Native Developers?

Hire React JS developer from Technoduce, we have a team of experienced and expert Angular JS developer. With our hire React JS developer, you have complete control over the technical resource throughout the development process.

Increase Performance of React Applications Via Array JavaScript Methods

Increase Performance of React Applications Via Array JavaScript Methods. We will create a simple event management application in the react to add, update, and delete an event.

Top VSCode Extensions for React, React Native, JavaScript and Productivity

Bunch of VSCode Extensions that improve quality of your coding time no matter what stack you are using. In this post, you'll see Top VSCode Extensions for React, React Native, JavaScript and Productivity

React cloneElement: A Better Way to Build a Component API Props in ES6 Javascript and Ts

Using the React cloneElement is a better way to build a component API props in ES6 Javascript and Typescript. Here's a tutorial on how to do so.