React Material UI Tab自定义CSS看起来像一个按钮 [英] React Material UI Tab custom css looks like a button

查看:56
本文介绍了React Material UI Tab自定义CSS看起来像一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使反应材料UI选项卡看起来像一个处于活动状态时具有不同颜色的按钮

参考代码:

现场演示

I am trying to make react material UI Tab look like a button that are different colors when they are active

Reference code : https://4ocqy.csb.app/

解决方案

Change your Tab style from:

style: {
  // tab style
  "&:active": {
     // select style
  }
}

To:

style: {
  // tab style
  "&.Mui-selected": {
     // select style
  }
}

You can know the className of a selected Tab by inspecting it in the devtool:

Live Demo

这篇关于React Material UI Tab自定义CSS看起来像一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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