Vuetify Component Framework
Vuetify is a comprehensive UI component framework for Vue.js, meticulously implementing Google's Material Design specification. Currently on its v4.0.5 release, with a parallel v3.x maintenance branch (latest v3.12.5), it provides over 80 reusable components that enable developers to build rich, responsive, and visually consistent web applications. The project maintains an active release cadence, frequently delivering bug fixes and new features across both major versions. A key differentiator is its deep integration with the Vue ecosystem, offering extensive customization options through SASS variables, theming, and a robust plugin architecture. However, the project has recently faced significant funding challenges, urging community support to continue compensating its core contributors, which may impact its long-term stability and development pace if not addressed. It is primarily used with Vue 3 and TypeScript.
Common errors
-
Vuetify is not installed correctly or 'vuetify' instance not found
cause The Vuetify plugin was not registered with the Vue application instance.fixEnsure you call `app.use(vuetify)` after `createApp` and before `mount`, where `vuetify` is the result of `createVuetify()`. -
Components appear unstyled or look incorrect, but the browser console has no errors.
cause Vuetify's core CSS styles have not been imported or are being overridden.fixAdd `import 'vuetify/styles';` to your application's entry file (e.g., `main.ts` or `main.js`). Also, verify no conflicting global styles are being applied. -
Module not found: Error: Can't resolve 'vuetify/lib/components' in ...
cause This error indicates using an outdated import path (common in v2) that is no longer valid in Vuetify v3 and v4.fixUpdate your imports to use `vuetify/components` instead of `vuetify/lib/components`. For example, `import { VBtn } from 'vuetify/components';`. -
Vue Compiler Error: Failed to resolve component: VBtn (or any Vuetify component)
cause The Vuetify components are not properly registered or are not being tree-shaken correctly by your bundler.fixEnsure `vuetify` is configured correctly with `app.use(vuetify)` and that you are either globally importing `* as components from 'vuetify/components'` or explicitly importing each component needed. Also, verify your bundler's Vuetify plugin is correctly set up.
Warnings
- breaking Vuetify v4.0.0 introduces significant breaking changes from v3, including internal architecture, tree-shaking improvements, and removal of deprecated paths. Direct upgrades without consulting the migration guide are likely to fail.
- gotcha The Vuetify project has recently announced critical funding exhaustion and is unable to compensate contributors. This could impact the project's long-term stability, development pace, and bug fix timelines.
- gotcha Forgetting to install and configure the bundler-specific plugin (e.g., `vite-plugin-vuetify` or `webpack-plugin-vuetify`) can lead to unstyled components, poor tree-shaking, or incorrect build outputs, especially in v3+ and v4.
- gotcha Not importing the global Vuetify styles (`import 'vuetify/styles';`) will result in unstyled components, appearing as raw HTML elements.
Install
-
npm install vuetify -
yarn add vuetify -
pnpm add vuetify
Imports
- createVuetify
const { createVuetify } = require('vuetify');import { createVuetify } from 'vuetify'; - Vuetify Styles
import 'vuetify/dist/vuetify.min.css';
import 'vuetify/styles';
- VBtn (individual component)
import VBtn from 'vuetify/components/VBtn';
import { VBtn } from 'vuetify/components'; - useDisplay (composable)
import { useDisplay } from 'vuetify/composables';import { useDisplay } from 'vuetify';
Quickstart
import { createApp } from 'vue';
import App from './App.vue';
import 'vuetify/styles'; // Essential: import global Vuetify styles
import { createVuetify } from 'vuetify';
import * as components from 'vuetify/components'; // Globally import all components for convenience
import * as directives from 'vuetify/directives'; // Globally import all directives
const vuetify = createVuetify({
components,
directives,
theme: { defaultTheme: 'light' }, // Example: set a light theme
});
createApp(App).use(vuetify).mount('#app');
// Then, in your App.vue or any component, you can use Vuetify components:
// <template>
// <v-app>
// <v-main>
// <v-container>
// <v-btn color="primary">Hello Vuetify</v-btn>
// </v-container>
// </v-main>
// </v-app>
// </template>