How to remove hover from button? Material UI v5

Estudante

When I put the mouse on the login button, the background color of the button doesn't stay white. How do I stay white? Help me please. I tried that but it didn't work.

<Button
  key={item}
  sx={{
   color: "secondary.contrastText",
   backgroundColor: "secondary.light",
   "&:hover": {
      backgroundColor: "transparent"
    }
   }}

Code in codesandbox

Cervus camelopardalis

If you set backgroundColor to transparent that means it will inherit it from the background element. Your background element (i.e., navbar) is orange, that's why the button becomes orange on hover.

This will solve your problem.

<Button
  key={item}
  sx={{
    color: "secondary.contrastText",
    backgroundColor: "secondary.light",
    "&:hover": {
      backgroundColor: "white"
    }
  }}
  size="medium"
>
  {item}
</Button>

See the forked snippet.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to get Material-UI V5 to auto-generate :hover colors in custom color objects for buttons

How to style a Drawer using Material-UI v5

How to replace Hidden component in Material-ui V5

How to remove hover effect from Bootstrap button?

How to open material-ui menu when hover on a button

how place a button at the center of the image on hover with Material UI (MUI) and reacts?

Material-ui v5 - where is DataGrid component? ( How to install DataGrid component in material-ui v5 In react?)

Material UI Raised Button change color on hover

Material UI Button Hover Not Working Absolute Position

How to remove selected value when click button of Autocomplete Material UI?

Material UI V5 Theming Customization

How to change hover color for Ant Design v5 Button with Tokens in React?

How can I change MUI v5 Button to lighten on hover instead of darken using theme?

Change Color of Text Field from Text Field in Material UI v5

How to remove quasar button hover

When migrating to Material-UI v5, how to deal with conditional classes?

How I add custom breakpoint to sx prop in material ui v5

How to access palette.secondary.light in material ui v5? TypeScript

Material UI v5 - how do I place components on new line while contained in a <Box>

How do I center a vertical divider within a Material UI (v5) Grid?

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

Mui / Material UI 5 : How to remove the open next view / open previous view buttons from StaticTimePicker?

Material UI Button remove focus frame

How to add background image to Button from material-ui in react?

How to fake the focus on a Material-ui TextField from a button click?

How to access main class function from material UI button component?

How to change color of not active button in ToggleButton from Material UI

How to remove the arrows icons from a Material UI TextField

How to remove default padding from material ui List Item?