How to avoid unlayered style's priority #1091
Replies: 1 comment 4 replies
-
I think your case is similar to the one discussed in Panda's discord here so I'm going to paste the relevant part of the discussion for better search indexing: Right now im using pandas with mantine v7. And it works well. But there is one issue. When overriding mantine styles with classNames prop, the styles are only applied if !important is used, which is kinda annoying. My question is, how can i make it so that i wont have to keep applying that !important? I tried adding another layer and importing mantine like @layer reset, base, tokens, recipes, utilities, mantine;
@import "@mantine/core/styles.css" layer(mantine); But no dice. I encountered a similar issue where I had to use !important to make utilities function properly. Eventually, I discovered that I needed to import the index.css file before the CSS files of other libraries. /* index.css */
@layer reset, base, tokens, recipes, utilities; // options.tsx
// need to import index.css first!
import "./index.css";
import "@some.other.library.css"; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm trying to create a design-system package using
panda
.I encountered a problem with the pandacss that I was using so well.
It was that the
unlayered style
defined in the app code had a higher priority thanpanda
's@layer
styles.I am attaching the codesandbox link to check this.
How do I get priority regardless of the css of the people I use?
The first solution I thought of is to use the
important
keyword.But I'm not sure this is the answer.
Should I adopt the CSS-in-JS method to provide an independent style regardless of my environment?
I'd appreciate it if you could give me your opinion.
Beta Was this translation helpful? Give feedback.
All reactions