如何通过主题调色板更改TextField下划线悬停颜色? [英] How can i change TextField underline hover color by theme palette?

查看:65
本文介绍了如何通过主题调色板更改TextField下划线悬停颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

material-ui v1

material-ui v1

如何通过主题调色板更改TextField下划线悬停颜色? 我知道可以通过覆盖来实现,但是它如何通过标准调色板选项适用于所有组件?像:

How can I change TextField underline hover color by theme palette? I know it possible by overrides, but how it can work for all components by standart palette options? like:

const themeMui = createMuiTheme({
  palette: {
    primary: lightBlue,
    secondary: blue,
    error: red,
    common: {
      darkBlack: blue.A700,
    }
  }
});

我到底要更改什么CSS代码:

What exactly CSS code I want to change:

推荐答案

嘿,我意识到这有点老了,但是我遇到了同样的问题.我想出了这个.希望对您有所帮助...那里的文档并不是最好的!

Hey I realize this is a bit old, but I have been having the same problem. I came up with this. Hope it helps... there docs are not the best on this!

const theme = createMuiTheme({
  overrides: {
    MuiInput: {
      underline: {
        color: 'red',
        '&:hover:not($disabled):after': {
          backgroundColor: 'red',
        },
        '&:hover:not($disabled):before': {
          backgroundColor: 'red',          // String should be terminated
        },
      },
    },
  },
});

这篇关于如何通过主题调色板更改TextField下划线悬停颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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