mui / mui/material-ui

[question] How to combine the two different Joy-UI themes.

Open
#43,687 6 comments 0 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Sep 10, 2024.

on hold package: joy-ui scope: all components support: commercial support: question
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

The problem in depth
const oneTheme: CssVarsThemeOptions = {
  colorSchemes: {
    light: {
      palette: {
        primary: {
          500: '#1976d2',
        },
      },
    },
  },
  components: {
    JoyButton: {
      styleOverrides: {
        root: {
          borderRadius: '8px',
        },
      },
    },
  },
};

// Second theme
const twoTheme: CssVarsThemeOptions = {
  colorSchemes: {
    light: {
      palette: {
        secondary: {
          500: '#dc004e',
        },
      },
    },
  },
  components: {
    JoyInput: {
      styleOverrides: {
        root: {
          backgroundColor: '#f0f0f0',
        },
      },
    },
  },
};

const combinedThemes = extendTheme({
    ...oneTheme,
    ...twoTheme,
    components: {
        ...oneTheme.components,
        ...twoTheme.components,
    },
} as Theme)

but I found that xxx.components cannot be recognized, Can you please help me solve it? I need to combine this two different theme together and also let the JoyButton and JoyInput working together as well

Your environment

next.js v14, typescript, Joy-Ui

Search keywords: Joy-UI extendTheme
Order ID: 97037

Search keywords:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.