How to change mui icons background color in react js?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

To change mui icons background color, set background-color: aqua !important; in MuiIconButton-root. It will change mui icons background color.

To change the mui icon background color with inline css, this code has to be written sx={{ color: "white", background Color: "#784734",}}.

Today, I am going to show you, How to change mui icons background color in react js.

Installation

Install the following packages to use mui icon in react js.

npm

npm install @mui/material @emotion/react @emotion/styled

yarn

yarn add @mui/material @emotion/react @emotion/styled

MUI material changed icons background color example.

The below code is an example of changing icons background color using mui.

App.js

import * as React from 'react';
import Stack from '@mui/material/Stack';
import IconButton from '@mui/material/IconButton';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
import "./App.css"


export default function IconButtonSizes() {
  return (
    <Stack direction="row" alignItems="center" spacing={1}>
      <IconButton aria-label="delete"  sx={{ 
    color: "white", 
    backgroundColor: "#784734", 

    borderRadius: "50%" 
  }}>
        <ArrowForwardIcon />
      </IconButton>
    </Stack>
  );
}

App.css

.MuiIconButton-root {
 background-color: aqua !important;
} 

In the above code example, I have used the @mui/material icons component and changed mui icons background color.

Check the output of the above code example.

React, Mui icons Background Icon

All the best 👍

Premium Content

You can get all the below premium content directly in your mail when you subscribe us

Books

Portfolio Template

View | Get Source Code

Cheat Sheets

Cheat Sheets Books are basically Important useful notes which we use in our day-to-day life.

I'm working on some more Cheat Sheets book on Jquery, TypeScript, React js and for other languages. I will send it once it's completed.

Related Posts