I use the library: https://www.npmjs.com/package/react-tooltip. I have a too long text, which is on one line, how can put it on multiple lines?
<p data-tip="hello world">Tooltip</p>
<ReactTooltip className="tooltip"/>
.tooltip {
  width: 100px;
}
                Just use the entity code 
 for a linebreak in a title attribute.
The Tooltip can be customized by using the cssClass property, which accepts custom CSS class names that define specific user-defined styles and themes to be applied on the Tooltip element.
To style React Material UI tooltip, we can use the makeStyles function. We call makeStyles with a function that returns an object that has some classes with some styles. We set the background color and the color in the classes.
You can use html={true} or multiline={true} both property to handle multiple line scenario
var tooltiptest = 'this is <br /> a test';
<div data-tip={tooltiptest} data-for='path'>Path</div>
<ReactTooltip id='path' type='light' html={true} />
your example:
<p data-for='path' data-tip="hello <br /> world">Tooltip</p>
<ReactTooltip id='path' className="tooltip" html={true} />
.tooltip {
  width: 100px;
}
<span data-tip='tooltip<br />multiline'></span>
<ReactTooltip multiline={true} />
your example
<p data-tip="hello <br /> world">Tooltip</p>
<ReactTooltip className="tooltip" multiline={true} />
.tooltip {
  width: 100px;
}
source - reference1 reference2

import React from "react";
import { withStyles } from "@material-ui/core/styles";
import ReactTooltip from "react-tooltip";
const styles = theme => ({
  overrideMe: {
    width: "100px",
    "word-break": "break-all",
    "overflow-wrap": "break-word",
    display: "block"
  }
});
class Opener extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      open: false
    };
  }
  render() {
    const { classes } = this.props;
    return (
      <div>
        <div>test content</div>
        <div>test content</div>
        <div>
          <p
            data-for="tt"
            data-tip="hello ccsdcssd csdccdsc ccdc sdcscds world"
          >
            Tooltip - hover me
          </p>
          <ReactTooltip
            className={classes["overrideMe"]}
            data-html={true}
            insecure={true}
            multiline={true}
            id="tt"
          />
        </div>
      </div>
    );
  }
}
export default withStyles(styles)(Opener);
play with the code - code sandbox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With