React Tooltip - Resize and Relocate

To change the size of the Tooltip, specify the height and width properties. Note that the Tooltip's arrow takes its share of the overall size.

  • 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}
  • height={70}
  • width={200}
  • />
  • </div>
  • );
  • }
  • }
  •  
  • export default App;

If you need to position the Tooltip against a certain side of the target element, set the position property.

  • 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}
  • position="top"/> {/* or "bottom" | "left" | "right" */}
  • </div>
  • );
  • }
  • }
  •  
  • export default App;
See Also