React Tooltip - Overview

The Tooltip UI component displays a tooltip for a specified element on the page.

View Demo

The following code creates a simple Tooltip on your page and attaches it to another element (in this example, to an image).

  • import React from 'react';
  • import 'devextreme/dist/css/dx.common.css';
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import { Tooltip } from 'devextreme-react/tooltip';
  •  
  • const renderContent = () => {
  • return (
  • <p>Tooltip content</p>
  • );
  • }
  •  
  • class App extends React.Component {
  • render() {
  • return (
  • <div>
  • <img id="image" src="https://url/to/an/image" />
  • <Tooltip
  • target="#image"
  • showEvent="dxhoverstart"
  • hideEvent="dxhoverend"
  • contentRender={renderContent}
  • />
  • </div>
  • );
  • }
  • }
  •  
  • export default App;
See Also