Replies: 2 comments 4 replies
-
For the component library I'm building right now based on our company design system, we offer a customization API using props for only certain styles that we want to allow customization. For example, we don't want to allow adding Then in the components, we merge the props and the base styles, like: className={css(someCva.raw({ whateverPropCvaAccepts }), { lineHeight })} There's a tiny bit of staticCss we need to generate to support this strategy. But the majority of our tokens are used somewhere in a component, so not so much actually. |
Beta Was this translation helpful? Give feedback.
-
We ultimately decided to exclude the Cascade Layer in this matter. Initially, having a Cascade Layer meant that the product-side reset CSS, which wasn't included in the layer, would override our styles. Here's a simple example to illustrate the issue:
To address this, we used the polyfill feature provided by Panda CSS to convert the layer to Here's a simple example to illustrate the issue:
In this setup, the reset CSS would override the design system styles, and the custom class wouldn't apply as expected. Here's a simple example to illustrate the issue:
To solve this, we used the Panda Integration Hooks to remove Here's how the CSS would look after the change:
I hope this solution helps someone facing a similar issue. However, I believe this method goes against the intended use of layers in Panda CSS and may not be the best approach. If anyone has a better solution, I would love to hear it. |
Beta Was this translation helpful? Give feedback.
-
Hello Panda CSS maintainers,
I am currently using Panda CSS to create a UI component library and have encountered a few issues that I would appreciate your advice on.
Specifically, the Cascade Layer
@layer
used by Panda CSS is causing problems because it loses specificity to classes outside the layer, leading to styles being overridden by application-level reset CSS and other styles. To address this, I used the--polyfill
option to generate CSS without layers, thereby increasing selector specificity.However, our UI component library is intended to be used across multiple applications, and there are cases where applications need to override styles. Previously, we handled this by accepting a
className
prop and appending it to the end of theclassNames
to increase specificity. But with the polyfill approach, application-level class names can no longer override the styles.Here is a simple example of how we were accepting class names:
One potential solution we considered is to accept CSSProperties as props and pass them to the element's
style
attribute. While this allows for style overrides, it does not leverage the benefits of the application's styling library.Do you have any suggestions or advice on how to address this issue effectively?
Thank you for your assistance.
Beta Was this translation helpful? Give feedback.
All reactions