You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [website] Add Armin to the team members (@arminmeh) (#42681) @arminmeh
57
+
- [website] Open Staff Engineer role for Pigment CSS (@mnajdova) (#42669) @mnajdova
58
+
59
+
All contributors of this release in alphabetical order: @alexfauquette, @alexismo, @arminmeh, @Danielkhakbaz, @DiegoAndai, @mnajdova, @oliviertassinari
Copy file name to clipboardExpand all lines: docs/data/joy/components/autocomplete/autocomplete.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -337,7 +337,7 @@ In the event you want the avoid autofill, you can try the following:
337
337
/>
338
338
```
339
339
340
-
Read [the guide on MDN](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion) for more details.
340
+
Read [the guide on MDN](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Turning_off_form_autocompletion) for more details.
Copy file name to clipboardExpand all lines: docs/data/joy/customization/dark-mode/dark-mode.md
+31-7Lines changed: 31 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,10 @@ When you change the `defaultMode` to another value, you must clear the local sto
12
12
13
13
{{"demo": "DarkModeByDefault.js"}}
14
14
15
-
For server-side applications, check out the framework setup in [the section below](#server-side-rendering) and provide the same value to the `getInitColorSchemeScript` function:
15
+
For server-side applications, check out the framework setup in [the section below](#server-side-rendering) and provide the same value to the `InitColorSchemeScript` component:
16
16
17
17
```js
18
-
getInitColorSchemeScript({ defaultMode:'dark' });
18
+
<InitColorSchemeScript defaultMode="dark"/>
19
19
```
20
20
21
21
## Matching device's preference
@@ -28,10 +28,10 @@ import { CssVarsProvider } from '@mui/joy/styles';
For server-side applications, check out the framework setup in [the section below](#server-side-rendering) and provide the same value to the `getInitColorSchemeScript` function:
31
+
For server-side applications, check out the framework setup in [the section below](#server-side-rendering) and provide the same value to the `InitColorSchemeScript` component:
@@ -121,23 +121,47 @@ If you try to render your UI based on the server, before mounting on the client,
121
121
122
122
### Avoiding screen flickering
123
123
124
-
To [prevent the UI from flickering](/joy-ui/main-features/dark-mode-optimization/#the-problem-flickering-on-first-load), apply `getInitColorSchemeScript()` before the main application script-it varies across frameworks:
124
+
To [prevent the UI from flickering](/joy-ui/main-features/dark-mode-optimization/#the-problem-flickering-on-first-load), add the `<InitColorSchemeScript />` component before the `<CssVarsProvider />` component:
125
+
126
+
### Next.js App Router
127
+
128
+
To use the Joy UI API with a Next.js project with the App Router, add the following code to the [`app/layout.js`](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#layouts) file in order to prevent flickering:
To use the Joy UI API with a Next.js project, add the following code to the custom [`pages/_document.js`](https://nextjs.org/docs/pages/building-your-application/routing/custom-document) file:
Copy file name to clipboardExpand all lines: docs/data/joy/main-features/dark-mode-optimization/dark-mode-optimization.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,22 +27,22 @@ Solving this problem required us to take a novel approach to styling and theming
27
27
28
28
Thanks to Joy UI's built-in support for CSS variables, your app can render all of its color schemes at build time, so that the user's preference can be injected _before_ the DOM is rendered in the browser.
29
29
30
-
Joy UI provides the `getInitColorSchemeScript()` function to make this flash-free dark mode possible with React frameworks like Next.js or Remix.
30
+
Joy UI provides the `InitColorSchemeScript` component to make this flash-free dark mode possible with React frameworks like Next.js or Remix.
31
31
This function must be placed before the main script so it can apply the correct stylesheet before your components are rendered.
32
32
33
33
The code snippet below shows how this works with the Next.js Pages Router:
0 commit comments