Pigment CSS: RFC discussion #40844
Replies: 18 comments 43 replies
-
Are there plans to make this zero runtime solution agnostic from MUI? Would be great to be able to build on this solution in other component libs as well |
Beta Was this translation helpful? Give feedback.
-
I would love for some solution that works well with CSS modules which is available in both Next.js and Astro, (I think this probably means css vars?) The current theme and runtime styling solution really makes MUI in Astro sort of a non-starter too, so just tossing it out there to keep that framework in mind. |
Beta Was this translation helpful? Give feedback.
-
Could you, please, clarify if MUI team already decided to use |
Beta Was this translation helpful? Give feedback.
-
FWIW, StyleX isn't "zero runtime". Having no runtime at all is not practical for atomic CSS libraries, as a runtime is needed to perform merging of styles during composition to avoid the kind of style conflicts that are common when using libraries like Tailwind. The runtime we use for StyleX is called styleQ - it's small, fast, and flexible enough to be used with any compiler not just StyleX. Although the repo has independent benchmarks, we also tested it on facebook.com where the runtime is called 15K times on the feed screen - it took 15ms and was 5x faster than the runtime we were using before. It's very easy to introduce slow paths in a runtime if you're not benchmarking after every change. |
Beta Was this translation helpful? Give feedback.
-
Excited for zero runtime! How can I write MUI system style code today that will be compatible with the new zero runtime? Will both of the below flavors be supported? <Button sx={{ mb: 3 }}>
// or
<Box mb={3}> |
Beta Was this translation helpful? Give feedback.
-
Excited for this as emotion js still doesn't support streaming server side rendering :/ emotion-js/emotion#2800 |
Beta Was this translation helpful? Give feedback.
-
Hi Team, Are there any plans to support an easy migration from v4 makeStyles API? It seems to have fairly decent usage still |
Beta Was this translation helpful? Give feedback.
-
Hey @brijeshb42, I tried out the recently released @pigment-css/react in my Next.js app and got the error: I'm wondering if it has to do with me using turbopack. Will the Next.js plugin support turbopack? Note, I'm wrapping my |
Beta Was this translation helpful? Give feedback.
-
How to start adapting |
Beta Was this translation helpful? Give feedback.
-
After all the discussion from the issue mentioned in OP. I see no mention of atomic styles in the readme. Is this intended for a future release or something that has been dismissed? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I have a question about how to leverage Pigment-CSS with runtime theme support. I see in the Pigment docs there ways to handle runtime based css for a component and separately about support things in the webpack/nextjs configs but I need a merge of the 2. We have a SaaS based product that builds a custom theme at runtime based on the tenant's settings and then use the theme through the app. This is all don't in the app.jsx Is there a way to do that with pigment as well are are we going yo start needing to used styled() everywhere now |
Beta Was this translation helpful? Give feedback.
-
Please don't forget about the |
Beta Was this translation helpful? Give feedback.
-
How does this affect/relate to Joy, especially regarding the efforts to rely on CSS-variables where possible? |
Beta Was this translation helpful? Give feedback.
-
I have an app that is built from dynamic settings. So the setttings are fetched and then merged into the build at run time. So, I can inject any available sx properties this way. It allows me to customize a version of the app per tenant. Will I be able to do this with pigment? |
Beta Was this translation helpful? Give feedback.
-
As I can see PigmentCSS focused on MPA(multi-page app, NextJs, and so on). Does SPA (single-page app) with PigmentCSS still work similarly to Emotion? Will it include some sort of plugin for Webpack/Esbuild? Because there is nothing about this in the docs https://mui.com/material-ui/migration/migrating-to-pigment-css/ |
Beta Was this translation helpful? Give feedback.
-
I have a use case similar to @experimarketing . We have a base theme that's applied on page load, but immediately after a request is made which fetches a custom them our users can configure. It alters things like the Unlike experimarketing's example however, all of this happens by merging the base and user themes and feeding the result to the |
Beta Was this translation helpful? Give feedback.
-
@GMchris, @experimarketing Hi there! Depending on the adjustments you need to the base theme, I would override the styles using the CSS variables the theme exposes. By doing so, you can override the styles at any point. You can even unmount that customization and get back to standard (the built theme). |
Beta Was this translation helpful? Give feedback.
-
@acomanescu After doing some research on this and thinking more about it, I don't think that using CSS vars allows me to do what I need. There are hundreds of css variables per component. Generally, I will only use a few, but occasionally you need to really customize a component. And I need to be able to do that when needed. So, I don't think this works for my use case. Does anyone know what the roadmap is for CSS for MUI? |
Beta Was this translation helpful? Give feedback.
-
Continuing the discussion from the RFC issue started in #38137
cc: @o-alexandrov @nmn @oliviertassinari @mnajdova @layershifter
Beta Was this translation helpful? Give feedback.
All reactions