如何修改工具提示组件的字体大小/样式? [英] How to modify font-size/style of Tooltip component?

查看:101
本文介绍了如何修改工具提示组件的字体大小/样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法将自定义类分配给工具提示组件以更新工具提示组件的样式

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

尝试通过分配给类属性

发布在 https://codesandbox.io/s/twilight-fire-907mp

推荐答案

使用自定义样式制作您自己的工具提示,然后使用它:

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

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

就像您对其他组件所做的一样,例如:DialogContentDialogActions.

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

用法

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

顺便说一句,您的代码令人困惑.您正在混合功能组件和类组件.一次,您将使用makeStyles进行一次样式化. 您应该选择一种方法并坚持下去.这是文档的样式.它将解决您的大多数问题.

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.

代码沙盒

这篇关于如何修改工具提示组件的字体大小/样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆