How to disable the hover effect of material-ui button inside of a styled component

ccd picture ccd · May 10, 2018 · Viewed 35.6k times · Source

I added the css hover property to disable the button's hover effect, but it seems not work for my case, how should I fix this?

import Button from 'material-ui/Button'
import styled from 'styled-components'

const StyledButton = styled(Button)`
  &:hover {
    background: none;
  }
`
export const SubmitButton = ({ onClick }) => {
  return (
    <StyledButton
      variant="raised"
      onClick={onClick}>
      login
    </StyledButton>
  )
}

Answer

ccd picture ccd · May 15, 2018

You can solve this problem by adding an inline style

export const SubmitButton = ({ onClick }) => {
  return (
    <StyledButton
      variant="raised"
      onClick={onClick}
      style={{ backgroundColor: 'transparent' }} >
      login
    </StyledButton>
  )
}