Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react - Difference between createMuiTheme and createTheme

As the title says. Both accept same kind of ThemeOptions object.

const theme = createMuiTheme({
  palette: {
    primary: {
      main: "#006400"
    },
    secondary: {
      main: "#ffa500"
    }
  }
});
const theme = createTheme({
  palette: {
    primary: {
      main: "#006400"
    },
    secondary: {
      main: "#ffa500"
    }
  }
});

Is createMuiTheme() only for applying styles to Mui components, and not my custom components?

If I want to create custom CSS classes, should I use makeStyles() instead?

like image 747
zhuhang.jasper Avatar asked Jan 28 '26 14:01

zhuhang.jasper


1 Answers

createTheme is the newer name, createMuiTheme is deprecated https://github.com/elyra-ai/elyra/pull/1885. You are correct createTheme() is used to apply different default styles to the Mui components

makeStyles() is a good way to make custom css classes for your new components or the Mui components.

like image 129
Gary B Avatar answered Jan 30 '26 08:01

Gary B



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!