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

534
Views
How to pass dynamic values into Material UI's createTheme()

I'm looking to pass data into Material UI's default theme, but I'm struggling to make it work.

Here's the theme definition on index.js:

let theme = createTheme({
  primary: {
    main: '#212121'
    }
})

And this is what I want to pass:

  primary: {
    main: data.website.live.theme.colors.primary
    }

This is what I tried:

let theme = createTheme(data, {
  primary: {
    main: data.website.live.theme.colors.primary
    }
})

But, this approach didn't work as createTheme only allows the following arguments:

  • Options (object): Takes an incomplete theme object and adds the missing parts.
  • ...args (object[]): Deep merge the arguments with the about to be returned theme.

Official documentation: https://mui.com/material-ui/customization/theming/#theme-provider

about 4 years ago · Juan Pablo Isaza
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!