Creating custom component with extendVariants fails typescript extraction #1862
Replies: 4 comments 1 reply
-
Or is there another way of extracting the props from Button? Would really appreciate help on this 🙏. I love this lib and would really like to avoid looking elsewhere 💙. |
Beta Was this translation helpful? Give feedback.
-
I have created a sandbox to show the issue. This issue is killing me and my hair is gone.. 😅 And if you want some rep on StackOverflow I have an issue there as well. I have got some awesome help but we are not quite there yet. |
Beta Was this translation helpful? Give feedback.
-
I have been trying a lot of solution regarding this, and almost came to an final one.. But I must use the This is the closest I have got to get a custom button based on NextUI that you can build as an npm package:
To anyone that will try to build a components lib as an npm package using NextUI (with TS) will need to look else where. I really like NextUI but it seems that the commity and maintainers don't know how to solve the above issue, because of the lack of answers. |
Beta Was this translation helpful? Give feedback.
-
I appreciate your effort. I'm trying to understand how to extend the library a bit and I found your message. Did you ever figure this out? Have you had a look at the source code and how they are doing it? |
Beta Was this translation helpful? Give feedback.
-
Hi!
Im trying to create a new and shiny components lib for our company.
Im going to extend some of NextUI's components and build our own.
I wanted to start simple by doing the classic button.
But unfortuantly I got stuck... when I build the npm package I get this:
I really want to use the basic of your button with all its glory and not creating my own.
But with this error our npm package loses it's type safety when used in the product.
Maybe I'm doing something wrong. First I did an exakt copy of the this, (also gives the error).
Then I built my own button that will have some more props etc. the end result is this:
But the extraction of the types in the build step fires the above error.
Vite config:
And as a siden note, if I create my own button using tailwind-variants everything works fine and I get type saftey in the component and no errors.
Beta Was this translation helpful? Give feedback.
All reactions