improved extendVariants for compoundVariants and compoundSlots #3218
dvzrd
started this conversation in
Feature requests
Replies: 2 comments
-
https://github.com/frontio-ai/heroui/blob/canary/packages/core/system-rsc/src/extend-variants.js |
Beta Was this translation helpful? Give feedback.
0 replies
-
related #1379 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As of right now, it's difficult to extend slot components with extendVariants because it doesn't allow for compoundSlots, you can only use compoundVariants right now but you can't pass an object with slots into the class. This limits extending components with slots.
For example, take the Card component:
The borderColor does not make it into the component because it has no understanding of className, being a slot component it will only understand the slot param key.
This doesn't work because className/class is typed as string or string[] at this time:
ref: https://www.tailwind-variants.org/docs/slots#slots-with-compound-variants
Also, can't use compoundSlots in case you want multiple slots to inherit the same compound variant overrides.
ref: https://www.tailwind-variants.org/docs/slots#compound-slots
For now, as a work around I'm just adding the border colors into the color variants, something like this:
But this would only work for this specific use case so it's not an ideal solution.
Beta Was this translation helpful? Give feedback.
All reactions