Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the border color when I hover a button with Material UI

I would like to be able to change the borderColor when I'm hovering on my button because right now it keep the blue of the primary color.

here's my code:

import React from 'react';
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';


const useStyles = makeStyles(theme => ({
    root: {
        '& > *': {
            margin: theme.spacing(1),
        },
    },
    btn: {
       fontFamily: "Manrope",
       borderColor: "#15e577",
       color: "#000",
       backgroundColor: "white", 
       "&:hover": {
           backgroundColor: "#15e577"
       },
    },

}));


export default function BtnContactUs() {
    const classes = useStyles();
    let theme = createMuiTheme
    return (
        <div className={classes.root}>
            <Button variant="outlined" color="primary" className={classes.btn}>
                Let's talk
            </Button>
        </div>
    );
}
like image 345
Deniss Avatar asked Dec 05 '25 20:12

Deniss


1 Answers

Use the borderColor property

btn: {
       fontFamily: "Manrope",
       borderColor: "#15e577",
       color: "#000",
       backgroundColor: "white", 
       "&:hover": {
           backgroundColor: "#15e577",
           borderColor:"#564345"

       },
    },
like image 166
kooskoos Avatar answered Dec 08 '25 10:12

kooskoos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!