Closed sleda closed 5 months ago
After running into an issue where the @radix-ui/themes styles weren't being applied to my React application despite following the official documentation, I found a workaround that solved the problem. Here's exactly what I did:
Create Popup.css
: First, a new CSS file named Popup.css was created in the same directory as Popup.jsx
.
Import @radix-ui Theme Styles:
Inside Popup.css, the @radix-ui/themes/styles.css was imported using the @
rule:
@import '@radix-ui/themes/styles.css';
Import Popup.css in Popup.jsx: Lastly, the Popup.css file was imported into Popup.jsx to ensure the styles are applied:
import './Popup.css';
By importing the CSS file into the JSX file, I made sure the styles were applied directly to my component, thus ensuring the @radix-ui theme styles were loaded and displayed as intended.
This isn't an issue with Radix Themes, you likely need to configure Webpack to import CSS files from external packages
I had already configured webpack that way and even tried it in another library like chakra ui to check it, it was working, but as I said, I solved it by putting @ in the './Popup.css' like this @import '@radix-ui/themes/styles.css';
My configures:
module: {
rules: [
{
// look for .css or .scss files
test: /\.(css|scss)$/,
// in the `src` directory
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
},
hmm any solutions yet? im also having problem to import tree-shaked radix-ui/styles.css
Issue Description: Despite following the official documentation and importing the @radix-ui/themes/styles.css file at the root of my React application, the theme styles are not being applied. The application still renders with default HTML styles.