Vue / Vite

Use Movk standalone components, theming and composables in a plain Vue + Vite project without Nuxt.
View source
Using Nuxt? See the Nuxt mode installation instructions.

@movk/nuxt is not just a Nuxt module — it also provides a Vite plugin (@movk/nuxt/vite) and a Vue plugin (@movk/nuxt/vue-plugin), making standalone UI components, AutoForm / DataTable, theming and non-server-side composables available directly in plain Vue + Vite projects.

Vue / Vite mode does not include the API integration domain (useApiFetch / useLazyApiFetch / useClientApiFetch, upload/download, $api plugin, auth and error toasts, etc.) — these depend on the Nuxt server runtime and are only available in Nuxt mode.

Installation

Install Dependencies

Requires @nuxt/ui >=4.13.0.

pnpm add @movk/nuxt @nuxt/ui zod tailwindcss

vue-router is enabled by default (controlled via the ui.router option). If using the default, also install vue-router:

pnpm add vue-router

Add the Vite Plugin

Register the movk() plugin in vite.config.ts:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import movk from '@movk/nuxt/vite'

export default defineConfig({
  plugins: [
    vue(),
    movk()
  ]
})
movk() internally registers unplugin-auto-import and unplugin-vue-components, which generate auto-imports.d.ts and components.d.ts. It is recommended to add them to .gitignore and include them in tsconfig.
tsconfig.app.json
{
  "include": ["src/**/*.ts", "src/**/*.vue", "auto-imports.d.ts", "components.d.ts"]
}
.gitignore
auto-imports.d.ts
components.d.ts
If using TypeScript, you can add aliases for theme virtual modules in tsconfig for completions in vite.config.ts:
tsconfig.node.json
{
  "compilerOptions": {
    "paths": {
      "#build/movk-ui": ["./node_modules/.movk-ui/movk-ui"],
      "#build/ui": ["./node_modules/.nuxt-ui/ui"]
    }
  }
}

Register the Vue Plugin

Register @movk/nuxt/vue-plugin in your entry file (it already links in @nuxt/ui/vue-plugin internally):

src/main.ts
import './assets/css/main.css'
import { createApp } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'
import movk from '@movk/nuxt/vue-plugin'
import App from './App.vue'

const router = createRouter({
  routes: [],
  history: createWebHistory()
})

createApp(App)
  .use(router)
  .use(movk)
  .mount('#app')

Import Styles

src/assets/css/main.css
@import "tailwindcss";
@import "@movk/nuxt";

Wrap the Root Component with <UApp>

<UApp> provides the global context for Toast, Tooltip and imperative overlays; useMessageBox depends on it:

src/App.vue
<template>
  <UApp>
    <RouterView />
  </UApp>
</template>
It is recommended to add class="isolate" to the root container (#app in index.html) to ensure proper style scoping and overlay stacking.

Coexisting with UnoCSS / Existing Global Styles

When adding Movk to an existing project, a common problem is that the background, padding, border radius and other styles of Nuxt UI components have no effect. The cause is cascade layers: Tailwind utilities live in @layer utilities, and any unlayered style beats styles inside @layer, regardless of selector specificity. The preflight (reset) that UnoCSS outputs by default and a project's own global reset are both unlayered.

In the Styles panel of the browser DevTools, rules without a cascade layer label are unlayered. In dev mode, movk() prints a warning in the terminal when UnoCSS outputs an unlayered reset.

Disable the UnoCSS Reset

@import "tailwindcss" already provides an equivalent reset in @layer base, so you can simply disable the UnoCSS reset:

uno.config.ts
import { defineConfig, presetWind4 } from 'unocss'

export default defineConfig({
  presets: [
    presetWind4({
      preflights: { reset: false }
    })
  ]
})
The presetWind4 switch is preflights.reset. A top-level reset: false has no effect.

Move the UnoCSS Preflight into the Base Layer

To keep the UnoCSS preflight, use outputToCssLayers to put it in Tailwind's base layer while utilities stay unlayered:

uno.config.ts
export default defineConfig({
  outputToCssLayers: {
    cssLayerName: layer => layer === 'preflights' ? 'base' : null
  }
})
Do not move UnoCSS utilities into a layer as well. If the project also has unlayered component library styles such as Element Plus, layered utilities lose to them, and existing code that overrides library styles with utilities stops working.

Move an Existing Global Reset into the Base Layer

Wrap the project's own reset in @layer base so it no longer overrides Nuxt UI utilities:

src/styles/reset.css
@layer base {
  *,
  ::before,
  ::after {
    margin: 0;
    padding: 0;
  }
}

Options

Pass options into movk() in vite.config.ts for configuration.

prefix Component Prefix

Component name prefix.

  • Default: M
vite.config.ts
movk({
  prefix: 'M'
})

site Site Information

Site name, affects the localStorage key prefix for theme persistence (<name>-ui-*).

vite.config.ts
movk({
  site: { name: 'my-app' }
})

theme Theme

theme.colors (color aliases), theme.defaultVariants (default variants), theme.prefix (aligned with the Tailwind prefix), etc. — mirrors the Nuxt mode movk.theme.

vite.config.ts
movk({
  theme: {
    defaultVariants: {
      color: 'neutral',
      size: 'sm'
    }
  }
})

icon Icons

icon.clientBundle controls whether the icons used by movk components and the built-in icon sets enter the build-time icon bundle, mirroring the Nuxt mode movk.icon. The icon data requires the matching @iconify-json/* packages in your project; collections that are not installed are skipped automatically (never a build failure). See Theme · Icon Sets.

vite.config.ts
movk({
  icon: { clientBundle: false }
})

ui

ui is a passthrough for @nuxt/ui unplugin configuration (Partial<NuxtUIOptions>), hosting router, colorMode, autoImport, components, dts, icon, ui theme, etc. Movk automatically injects its own composables, component resolution and icons into ui.autoImport / ui.components / ui.icon.clientBundle.icons, so no manual configuration is needed.

See the Nuxt UI module docs for the full configuration and features of the ui option.
Copyright © 2025 - 2026 YiXuan - MIT License