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] Add live demo with CssVarsProvider #38792

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 3, 2023

I never understood why we didn't have a live demo with CssVarsProvider for Material UI. I have struggled to make this one, I struggled on a couple of points (e.g. tried to use createTheme, tried to use prefix, I didn't know where to import extendTheme from).

Use case: mui/mui-x#10214
Preview: https://deploy-preview-38792--material-ui.netlify.app/material-ui/experimental-api/css-theme-variables/usage/#getting-started

Regarding the CSS size, the CSS variables added to the HTML docs adds 4 kB gzipped. It doesn't seem to really impact performance: https://www.webpagetest.org/video/compare.php?tests=230903_BiDcR6_A0Z,230903_AiDcV1_A8W.


The dark/light mode switch is broken, but it's beyond this PR. We need to fix this as well to fully migrate our docs to use CSS vars #39047.

Screen.Recording.2023-09-18.at.22.23.44.mov

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation package: material-ui Specific to @mui/material labels Sep 3, 2023
@@ -210,7 +210,6 @@ See the complete usage of `createVssVarsProvider` in [Material UI](https://githu
- `defaultMode?: 'light' | 'dark' | 'system'` - Application's default mode (`light` by default)
- `disableTransitionOnChange : boolean` - Disable CSS transitions when switching between modes
- `enableColorScheme: boolean` - Indicate to the browser which color scheme is used (light or dark) for rendering built-in UI
- `prefix: string` - CSS variable prefix
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't exist, outdated docs.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 6, 2023
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Sep 10, 2023
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 18, 2023
@oliviertassinari oliviertassinari merged commit 1ad6d26 into mui:master Sep 18, 2023
9 checks passed
@oliviertassinari oliviertassinari deleted the demo-css-variables branch September 18, 2023 20:26
christophermorin pushed a commit to christophermorin/material-ui that referenced this pull request Sep 21, 2023
Signed-off-by: Olivier Tassinari <[email protected]>
Co-authored-by: Danilo Leal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants