☁️ React Wordcloud
Edit page
HomeReadmeProps
Usage
BasicSizeCallbacksColors and TooltipsMouse EventsTransitionsOptionsOptimizations
FAQChangelog

Callbacks

react-wordcloud provides a callbacks prop to configure detailed word colors, tooltips and events.

Colors and Tooltips

By default, react-wordcloud randomnly applies colors to words using colors from the colors prop. It also defaults to using the word.text field for rendering tooltips.

In the example below, we can pass custom getWordColor and getWordTooltip callbacks to update word colors and tooltips based on the word data.

Mouse Events

You can pass callbacks such as onWordClick, onWordMouseEnter and onWordMouseLeave to capture the word and mouse events. The following example shows how we can work with the captured word and mouse events to create an enlarged word that opens an external link.