How to modify font-size/style of Tooltip component?

主宰稳场 提交于 2020-01-16 19:37:07

问题


Not able to assign custom class to tooltip component in order to update the style of tooltip component

Tried by assigning to classes property

Posted at https://codesandbox.io/s/twilight-fire-907mp


回答1:


Make your own Tooltip with custom styles and then use it:

const TooltipWithBiggerFontSize = withStyles({
  tooltip: {
    fontSize: 30
  }
})(Tooltip)

As you already did with other components, eg: DialogContent or DialogActions.

Usage

<TooltipWithBiggerFontSize title="Custom Search">
  <Publish />
</TooltipWithBiggerFontSize>

BTW, your code is confusing. You are mixing functional and class components. Once, you are styling with withStyles once with makeStyles. You should choose one method and stick to it. Here is styling docs. It will solve most of your problems.

codesandbox



来源:https://stackoverflow.com/questions/56885144/how-to-modify-font-size-style-of-tooltip-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!