Make it easier to pass React props to cva component #40
Replies: 5 comments 1 reply
-
Thanks @sandgraham! It’s something I’ve thought about adding — as a prop and as a separate package — but it feels like a lot of overhead for one framework (FWIW I use React too) Not ruling this out just yet, but I think it’s fairly unlikely I’ll do this anytime soon |
Beta Was this translation helpful? Give feedback.
-
@joe-bell I'm curious, when you're using cva with react do you manually unpack the class property to pass it to className? |
Beta Was this translation helpful? Give feedback.
-
I manually destructure |
Beta Was this translation helpful? Give feedback.
-
Hey! I think it makes sense for this library to alias Either that or naming the prop Love the library btw! Awesome work with the api and the typings :) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Using React, it would be nice if I could pass all props to my
cva
component. Currently I always have to destructureclassName
and pass it toclass
. PerhapsclassName
could be added as an alias forclass
as a non-breaking change?Describe the solution you'd like
Coming from
stitches
I also sometimes miss the ability to extract non-variant props from the component call:Describe alternatives you've considered
I suppose I could wrap
cva
and the returned component function such thatclassName
is mapped toclass
. I haven't tried it so perhaps it isn't so bad. Still, I imagine others using React might benefit from this type of functionality being built in.Thanks 🙌
Beta Was this translation helpful? Give feedback.
All reactions