如何在Material-UI v1中实现自定义选项卡指示器颜色 [英] How to implement custom Tab indicator color in Material-UI v1

查看:335
本文介绍了如何在Material-UI v1中实现自定义选项卡指示器颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在生产站点上运行的MUI v1 beta 32非常好. 是时候更新到v1了! 到目前为止,更改非常简单.这主要是更新导入标签的问题.

I have MUI v1 beta 32 running on a production site, very nicely. Time to update to v1! So far, changes have been very simple. It's mostly been a matter of updating the import tags.

但是我选择的<Tab/>指示器遇到了问题. 我正在使用rootInheritSelected样式替代项来应用自己选择的颜色.

But I am running into an issue with my selected <Tab/> indicator. I was using the rootInheritSelected style override in order to apply the color of my choice.

如何在v1中实现它?

推荐答案

最后,我发现它要简单得多:

In the end I found it was much simpler:

<Tabs
  textColor="inherit"
  fullWidth
  centered
  classes={{
    indicator: classes.indicator
  }}>
    <Tab />
    <Tab />
</Tabs>

和样式:

const styles = theme => ({
  indicator: {
    backgroundColor: 'white',
  },
})

这篇关于如何在Material-UI v1中实现自定义选项卡指示器颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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