ThemeProvider Not Applying Styles in Vite Setup #5664
-
I'm facing an issue where ThemeProvider from @primer/react does not apply styles dynamically unless I manually import @primer/css/dist/primer.css. When I import @primer/css manually, styles apply correctly. What I've Already Tested This is App.jsx
export default App; Setup Environment |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Things seem to have broken in 3.6.0+ ish |
Beta Was this translation helpful? Give feedback.
-
Hi there, @luislufttech! 👋 Sorry about the issues that you're running into when applying styles in Vite, I think this is pointing to a gap in our documentation as we're moving towards CSS Modules. We have an example in the project that uses vite here: https://github.com/primer/react/tree/main/examples/codesandbox and I think you're spot on with the setup or This package exports each specific theme that can be imported, for example the following line will import the light theme: import "@primer/primitives/dist/css/functional/themes/light.css"; Hope that resolves the issue that you're running into, let me know if not! We'll also make sure to update the documentation to reflect this 👍 Sorry again about the issue here! |
Beta Was this translation helpful? Give feedback.
Hi there, @luislufttech! 👋 Sorry about the issues that you're running into when applying styles in Vite, I think this is pointing to a gap in our documentation as we're moving towards CSS Modules.
We have an example in the project that uses vite here: https://github.com/primer/react/tree/main/examples/codesandbox and I think you're spot on with the setup or
ThemeProvider
andBaseStyles
and what is likely missing are imports to@primer/primitives
so that the CSS Custom Properties are setup correctly.This package exports each specific theme that can be imported, for example the following line will import the light theme:
Hop…