You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I'm using the borderRadius property in both variants, it's possible that due to the different order of the keys, the later key overwrites the earlier one. But usually, there is no concept of order for the keys of an object, they should all belong to the hierarchy, because the order of the keys is difficult to control after the object has been used with an expander, or if the properties of that variant are passed in by props.
Adjusts the priority of variants to be determined by the order in which they are defined in the recipe, with later-defined variants overriding a style in a first-defined variant if it already exists.
For example, the shape variant I'm defining here should override one of the borderRaius already defined in the size variant:
But each of my sizes is the same style when shape is square, it would be a pain to declare them all manually, is it possible to implement a mechanism similar to wildcard character:
This discussion was converted from issue #1495 on October 10, 2023 20:20.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Description
Support for configuring variant priorities in recipes.
Problem Statement/Justification
When I write such a variant in a recipe:
I've found that the order of the key of the passed-in object parameters affects the style:
Since I'm using the
borderRadius
property in both variants, it's possible that due to the different order of the keys, the later key overwrites the earlier one. But usually, there is no concept of order for the keys of an object, they should all belong to the hierarchy, because the order of the keys is difficult to control after the object has been used with an expander, or if the properties of that variant are passed in by props.https://play.panda-css.com/lS-v1Y47O5
Proposed Solution or API
Adjusts the priority of variants to be determined by the order in which they are defined in the recipe, with later-defined variants overriding a style in a first-defined variant if it already exists.
For example, the
shape
variant I'm defining here should override one of theborderRaius
already defined in thesize
variant:Alternatives
Currently I can override the presence of size and shape in a component with compound variants:
But each of my sizes is the same style when shape is
square
, it would be a pain to declare them all manually, is it possible to implement a mechanism similar to wildcard character:If the
*
symbol is used it represents a match for all sizes.Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions