docs/data/material/customization/css-theme-variables/overview.md
CSS variables are a modern cross-browser feature that let you declare variables in CSS and reuse them in other properties. You can implement them to improve Material UI's theming and customization experience.
:::info If this is your first time encountering CSS variables, you should check out the MDN Web Docs on CSS custom properties before continuing here. :::
CSS theme variables replace raw values in Material UI components for a better developer experience because, in the browser dev tool, you will see which theme token is used as a value.
In addition with these variables, you can inject a theme into your app's stylesheet at build time to apply the user's selected settings before the whole app is rendered.
light and dark.For server-side applications, there are some trade-offs to consider:
| Compare to the default method | Reason | |
|---|---|---|
| HTML size | Bigger | CSS variables are generated for both light and dark mode at build time. |
| First Contentful Paint (FCP) | Longer | Since the HTML size is bigger, the time to download the HTML before showing the content is a bit longer. |
| Time to Interactive (TTI) | Shorter (for dark mode) | Stylesheets are not regenerated between light and dark mode, a lot less time is spent running JavaScript code. |
:::warning The comparison described in the table above may not be applicable to large and complex applications since there are so many factors that can impact performance metrics. :::