Nuxt
vael-ui/nuxt is a Nuxt module. Add it once, and you can use any vael-ui component in a template without importing it. It uses Nuxt’s own component registration, not unplugin-vue-components.
Setup
Register the module in your Nuxt config:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['vael-ui/nuxt'],
})Write the tag, and Nuxt resolves the import for you:
<template>
<Button variant="primary">Save</Button>
</template>App setup
The module doesn’t mount the hosts. Mount the ones you use once in app.vue. Global setup explains what each one does.
<!-- app.vue -->
<template>
<TooltipHost />
<DialogHost />
<PopoverHost />
<Toaster />
<NuxtPage />
</template>Composables such as toast() and openDialog() aren’t auto-imported. Import them from 'vael-ui', or from 'vael-ui/vapor' with the Vapor variant:
<!-- pages/index.vue -->
<script setup lang="ts">
import { toast } from 'vael-ui'
</script>
<template>
<Button @click="toast('Saved')">Save</Button>
</template>The module registers v-animate for you, but not v-tooltip, v-scroll-mask or v-hover-indicator. Register those in a plugin. With the Vapor variant, import them from 'vael-ui/vapor':
// plugins/vael-ui.ts
import { vTooltip, vScrollMask, vHoverIndicator } from 'vael-ui'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.directive('tooltip', vTooltip)
nuxtApp.vueApp.directive('scroll-mask', vScrollMask)
nuxtApp.vueApp.directive('hover-indicator', vHoverIndicator)
})exclude
Skip specific component names, such as to register your own <Button> under the same tag:
export default defineNuxtConfig({
modules: ['vael-ui/nuxt'],
vaelUi: {
exclude: ['Button'],
},
})Vapor
Set variant: 'vapor' to use vael-ui/vapor, the same option vael-ui/resolver takes. The module turns on Nuxt’s vue.vapor for you. It needs Nuxt 4.6 or later and Vue 3.6. Pin Vue to the exact version given in Getting started.
export default defineNuxtConfig({
modules: ['vael-ui/nuxt'],
vaelUi: {
variant: 'vapor',
},
})Pages still render on the server. The server renders each component to HTML, and the browser hydrates it as a Vapor component, with nothing else to configure.
To compile your own <script setup> components as Vapor too, without adding vapor to each one, turn on @vitejs/plugin-vue’s features.vapor through Nuxt’s vite.vue:
export default defineNuxtConfig({
modules: ['vael-ui/nuxt'],
vaelUi: { variant: 'vapor' },
vite: { vue: { features: { vapor: true } } },
})Using unplugin-vue-components instead
If your Nuxt app already uses unplugin-vue-components to auto-import other libraries, use vael-ui/resolver instead. See the Auto import guide.