Convenient way to split cva / other props #304
CGamesPlay
started this conversation in
Feedback
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This comes up every time I use CVA in a new project. I have a low-level component like
Button
, and it accepts come CVA props, HTML props, and custom props. It would be great to have an entry point into CVA that returned the computed class as well as the props that were unused. It could look something like this:This could be used in React like so:
The version I have is implemented as an HOC for React, but the gist is here: cva.tsx
Update: I made a different version which might be suitable for inclusion in the core library. It is a top-level method, so that tree-shaking would remove it. cva.tsx
Beta Was this translation helpful? Give feedback.
All reactions