Antdv Next module for Nuxt
- Auto register
antdv-nextcomponents as global Nuxt components. - Optional auto register icons from
@antdv-next/icons. - Component prefix support (default:
A), e.g.AButton. - SSR-safe CSS-in-JS setup and style extraction on server render.
- Adds
vite-plugin-dayjsautomatically when using Vite builder.
- Nuxt >= 4.0.0
- Vue >= 3.5.0
- antdv-next >= 1.0.4
- @antdv-next/icons >= 1.0.1
npx nuxi@latest module add @antdv-next/nuxt
# or
pnpm add -D @antdv-next/nuxt antdv-next @antdv-next/iconsexport default defineNuxtConfig({
modules: ['@antdv-next/nuxt'],
antd: {
icon: true,
},
})@antdv-next/nuxt uses antd as the config key.
<template>
<a-button type="primary">Primary</a-button>
<HomeOutlined />
</template>If you keep the default prefix, component names are registered as A* (for example AButton, ATable, AQrcode).
For reset styles:
export default defineNuxtConfig({
css: ['antdv-next/dist/reset.css'],
})For zero-runtime theme mode (recommended), also include:
export default defineNuxtConfig({
css: [
'antdv-next/dist/reset.css',
'antdv-next/dist/antd.css',
],
})Warning
If nuxt devtools is enabled, style loading in development may become slower.
If you see slow style hydration or temporarily unclickable UI, try disabling nuxt devtools, or wait until related loading in the console is finished.
This does not affect normal precompiled development flow or production builds.
| Option | Type | Default | Description |
|---|---|---|---|
icon |
boolean |
false |
Enable auto registration of icons from @antdv-next/icons. |
prefix |
string |
'A' |
Prefix for auto-registered components. |
include |
ComponentName[] |
undefined |
Only register listed components. Takes precedence over exclude. |
exclude |
ComponentName[] |
undefined |
Exclude listed components when include is not set. |
includeIcons |
IconName[] |
undefined |
Only register listed icons. Takes precedence over excludeIcons. |
excludeIcons |
IconName[] |
undefined |
Exclude listed icons when includeIcons is not set. |
Notes:
ComponentNamevalues come from src/runtime/components.ts.IconNamevalues come from src/runtime/icons.ts.includeIconsandexcludeIconsare effective only wheniconis enabled.
pnpm install
pnpm dev:prepare
pnpm dev
pnpm dev:build
pnpm lint
pnpm test