Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Unable to use custom palette for mui component

I'm trying to get the background colour to be the midnightBlue, and i'm getting an error:

TypeError: Cannot read properties of undefined (reading '100')

After checking the syntax, I can't catch any errors. This seems to be a dependancy issue i'm thinking?

Thanks in advance

import AppBar from "@mui/material/AppBar";
import Box from "@mui/material/Box";
import Toolbar from "@mui/material/Toolbar";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import { ThemeProvider, createTheme } from "@mui/system";

const Navbar = () => {
  const theme = createTheme({
    palette: {
      background: {
        midnightBlue: "#0A1929"
      }
    },
  });

  return (
    <ThemeProvider theme={theme}>
      <Box sx={{ flexGrow: 1, bgColor: "background.midnightBlue"}}>
        <AppBar position="static">
          <Toolbar>
            <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
              Name
            </Typography>
            <Button color="inherit">Link 1</Button>
            <Button color="inherit">Link 2</Button>
            <Button color="inherit">Link 3</Button>
            <Button color="inherit">Link 4</Button>
          </Toolbar>
        </AppBar>
      </Box>
    </ThemeProvider>
  );
};

export default Navbar;

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

So I went and checked, and your import is wrong, it should be like this

import { ThemeProvider, createTheme } from "@mui/material/styles";
about 4 years ago · Juan Pablo Isaza Report

0

You're import is incorrect. It should be:

import { createTheme, ThemeProvider } from "@mui/material" 

Tip: Sometimes when you auto import, some components get imported from "@mui/system" which leads to such issues, most of the time named import from "@mui/material" will suffice.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!