Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Using Joy UI and Material UI together #45134

Open
atillaaliyev opened this issue Jan 28, 2025 · 1 comment
Open

[docs] Using Joy UI and Material UI together #45134

atillaaliyev opened this issue Jan 28, 2025 · 1 comment
Assignees
Labels
linked in docs The issue is linked in the docs, so completely skew the upvotes package: joy-ui Specific to @mui/joy ready to take Help wanted. Guidance available. There is a high chance the change will be accepted support: docs-feedback Feedback from documentation page

Comments

@atillaaliyev
Copy link

atillaaliyev commented Jan 28, 2025

Related page

https://mui.com/joy-ui/integrations/material-ui/#set-up-the-providers , https://mui.com/material-ui/integrations/theme-scoping/

Kind of issue

Unclear explanations

Issue description

I'm using Joy UI with Material UI. However, I dont understand which document is right.

This correct ;

import { ThemeProvider, THEME_ID, createTheme } from '@mui/material/styles';
import { AnotherThemeProvider } from 'another-ui-library';

const materialTheme = createTheme(/* your theme */);

function App() {
  return (
    <AnotherThemeProvider>
      <ThemeProvider theme={{ [THEME_ID]: materialTheme }}>
        {/* components from another library and Material UI */}
      </ThemeProvider>
    </AnotherThemeProvider>
  );
}

or this ;

import {
  extendTheme as materialExtendTheme,
  CssVarsProvider as MaterialCssVarsProvider,
  THEME_ID as MATERIAL_THEME_ID,
} from '@mui/material/styles';
import { CssVarsProvider as JoyCssVarsProvider } from '@mui/joy/styles';
import CssBaseline from '@mui/material/CssBaseline';

const materialTheme = materialExtendTheme();

export default function App() {
  return (
    <MaterialCssVarsProvider theme={{ [MATERIAL_THEME_ID]: materialTheme }}>
      <JoyCssVarsProvider>
        <CssBaseline enableColorScheme />
        ...Material UI and Joy UI components
      </JoyCssVarsProvider>
    </MaterialCssVarsProvider>
  );
}

Context

No response

Search keywords: using-joy-with-mui

@atillaaliyev atillaaliyev added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Jan 28, 2025
@zannager zannager added package: joy-ui Specific to @mui/joy linked in docs The issue is linked in the docs, so completely skew the upvotes labels Jan 30, 2025
@siriwatknp
Copy link
Member

siriwatknp commented Jan 31, 2025

If you are using Material UI v6, this is the correct one.

import {
  createTheme,
  ThemeProvider,
  THEME_ID as MATERIAL_THEME_ID,
} from '@mui/material/styles';
import { CssVarsProvider as JoyCssVarsProvider } from '@mui/joy/styles';
import CssBaseline from '@mui/material/CssBaseline';

const materialTheme = createTheme();

export default function App() {
  return (
    <ThemeProvider theme={{ [MATERIAL_THEME_ID]: materialTheme }}>
      <JoyCssVarsProvider>
        <CssBaseline enableColorScheme />
        ...Material UI and Joy UI components
      </JoyCssVarsProvider>
    </ThemeProvider>
  );
}

I mark this as ready to take if anyone would like to take this up to update https://mui.com/joy-ui/integrations/material-ui/#set-up-the-providers.

@siriwatknp siriwatknp added ready to take Help wanted. Guidance available. There is a high chance the change will be accepted and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linked in docs The issue is linked in the docs, so completely skew the upvotes package: joy-ui Specific to @mui/joy ready to take Help wanted. Guidance available. There is a high chance the change will be accepted support: docs-feedback Feedback from documentation page
Projects
None yet
Development

No branches or pull requests

3 participants