Issue
I implemented a tooltip with Material UI but the fontSize is too small. And I can't change it with a .scss.
import React from "react";
import "./InfoTooltip.scss";
import InfoIcon from '@material-ui/icons/Info';
import Tooltip from '@material-ui/core/Tooltip';
const InfoTooltip: React.FC<{ children?: any }> = ({ children }) => {
  const [label, ...rest] = children;
  return (
    <div className="info-tooltip-container">
      <div className="label-container">
        <Tooltip title={label}>
          <InfoIcon style={{ fontSize: '24px' }} />
        </Tooltip>
      </div>
      {rest}
    </div>
  );
};
export default InfoTooltip;
.info-tooltip-container {
  .label-container {
    font-size: 18px;
  }
  label {
    font-size: 18px;
  }
}
https://mui.com/material-ui/react-tooltip/
Solution
You can add a customized component directly to props title.
If needed, you can add whatever inline-styles to the component you just added.
Include the font-size
<Tooltip title={<h1 style={{ color: "lightblue" }}>title</h1>}>
  <InfoIcon />
</Tooltip>
Refer: MUI tooltip document: customized-tooltips
Answered By - keikai
 

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.