How to implement custom Tab indicator color in Material-UI v1

≯℡__Kan透↙ 提交于 2019-12-10 23:17:42

问题


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.

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.

How to implement it in v1?


回答1:


In the end I found it was much simpler:

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

and the styles:

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


来源:https://stackoverflow.com/questions/50533704/how-to-implement-custom-tab-indicator-color-in-material-ui-v1

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