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

[joy-ui][docs] Update "Set up providers" section of integration with Material UI #45183

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/data/joy/integrations/material-ui/material-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ Additionally, keep these in mind when using them together:

## Set up the providers

Render Joy UI's `CssVarsProvider` inside Material UI's provider and use `THEME_ID` to separate the themes from each other.
Render Joy UI's `CssVarsProvider` inside Material UI's `ThemeProvider` and use `THEME_ID` to separate the themes from each other.

```js
import {
extendTheme as materialExtendTheme,
CssVarsProvider as MaterialCssVarsProvider,
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 = materialExtendTheme();
const materialTheme = createTheme();

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