Search code examples
javascriptvue.jsvuejs3vuetify.jsvite

How to export all vuetify3 components in a customized library?


I am building a reusable UI Component library with Vuetify, Vue 3 and Vite following this guide: https://medium.com/@mattlcoleman88/crafting-a-reusable-ui-component-library-with-vuetify-vue-3-and-gitlab-f7364b0d4b79

Currently I can import the MyButton from the demo app, My question is, if I want to use VBtn from vuetify itself, how can I do it?

Can I export all the vuetify components in my Component library? If yes, how can I achieve it, via vite config or via manual code?

BTW, I know there is another solution is to separate vuetify and the customized library, and add 'vuetify' as a peer dependency in customized library.


Solution

  • In the main file of your library, where you export all your custom components, you should be able to add export * from 'vuetify/components' to also export all Vuetify components.

    Every export is documented so you can use the same notation to export what you need.