Installation & Integration Guide

Reference for installing @vanduo-oss/vd3: plugin options, the optional canvas bundle, vite-ssg, and Nuxt. For a five-minute first page, start at Getting started. VD3 UI is Vue 3 only.

What tree-shakes. Named JS imports tree-shake. VanduoVue does not register components globally — import each Vd* you use. @vanduo-oss/vd3/css is the full stylesheet; /css/core is the same tree without bundled icon fonts, not a tokens-only sheet.
Install the package

Install the design system. Add charts or flowchart if your app needs them.

# The Vue 3 component library (tokens + CSS + components)
pnpm add @vanduo-oss/vd3

# Charts and flowchart ship as dedicated packages
pnpm add @vanduo-oss/vd3-charts
pnpm add @vanduo-oss/vd3-flowchart
Register the plugin & styles

Import @vanduo-oss/vd3/css once in your entry file so the whole stylesheet is loaded, then install the plugin:

// main.ts — register the plugin and the stylesheet once
import { createApp } from 'vue';
import { VanduoVue } from '@vanduo-oss/vd3';
import '@vanduo-oss/vd3/css';
import App from './App.vue';

createApp(App).use(VanduoVue).mount('#app');

VanduoVue only applies theme defaults and the storage prefix — it does not register components globally:

OptionTypeDescription
themeDefaultsPartial<ThemeDefaults>Site-specific overrides shallow-merged over the generated theme baseline (e.g. { PRIMARY_DARK: 'green' }). Applied synchronously on install, before the theme model first reads its defaults. Optional.
storagePrefixstringlocalStorage key prefix for theme preferences (default "vanduo-"). Applied synchronously on install, before the first storage read. Use a unique prefix when two apps share an origin so keys do not collide. Example: "my-app-" → my-app-theme-preference, my-app-palette, …
themePersistencebooleanWhen false, theme changes still apply on the document but are not written to localStorage. Default true.
Use the components

Import Vd* components from @vanduo-oss/vd3 — typed, tree-shakeable, ready to compose:

<script setup lang="ts">
import { VdCard, VdButton } from '@vanduo-oss/vd3';
</script>

<template>
  <VdCard>
    <h1>Build fast with VD3 UI</h1>
    <p class="vd-text-lg vd-text-muted">First-class Vue 3 components.</p>
    <VdButton variant="primary" size="lg">Get started</VdButton>
  </VdCard>
</template>

Import each optional package and its stylesheet:

vite-ssg & SSR

Every Vd* component is SSR-safe — no window or DOM access at module or setup scope, with browser-only work (observers, listeners) deferred to onMounted. Register the plugin inside the vite-ssg setup callback:

Browser guards support static SSR shells. Theme defaults, preferences and toast queues are shared at module scope; do not write request-specific values during server rendering. A storage prefix separates browser keys, not app state. Independent requests or apps need an app-owned state boundary.

// main.ts — SSR / SSG entry with vite-ssg
import { ViteSSG } from 'vite-ssg';
import { VanduoVue } from '@vanduo-oss/vd3';
import '@vanduo-oss/vd3/css';
import App from './App.vue';
import { routes } from './routes';

export const createApp = ViteSSG(App, { routes }, ({ app }) => {
  app.use(VanduoVue, {
    storagePrefix: 'my-app-',
    themeDefaults: { PRIMARY_DARK: 'green' },
  });
});
  • Import @vanduo-oss/vd3/css in the entry so the stylesheet is baked into the prerendered HTML (no flash of unstyled content).
  • Set themeDefaults (and storagePrefix if you need it) in the setup callback so the first server-rendered paint matches the client.
Nuxt

Load the stylesheet from nuxt.config, then install VanduoVue in a client plugin so localStorage theming stays off the server:

// nuxt.config.ts
export default defineNuxtConfig({
  css: ['@vanduo-oss/vd3/css'],
});
// plugins/vanduo.client.ts
import { VanduoVue } from '@vanduo-oss/vd3';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(VanduoVue, {
    storagePrefix: 'my-app-',
    themeDefaults: { PRIMARY_DARK: 'green' },
  });
});

If @nuxtjs/color-mode already owns light/dark, bridge it instead of adding a second toggle:

Scaffold with npx nuxi@latest init my-app, then pnpm add @vanduo-oss/vd3. Named imports stay explicit — VD3 UI does not ship a Nuxt auto-import module. To avoid a flash of the wrong theme during SSR, stamp data-theme on <html> with useHead:

More on the bridge: CSS variables & theming.

Nuxt UI and Tailwind CSS

VD3 UI and Nuxt UI are meant to sit in the same Nuxt app. Nuxt UI components are U* and tokens are --ui-*. VD3 UI components are Vd* and tokens are --vd-*. Use VD3 UI where you want Fibonacci spacing, Seemore glass, the dock, charts, or flowchart, and Nuxt UI where its form, overlay, and dashboard components already fit. Neither library replaces the other.

Put VD3 UI in a cascade layer so Tailwind utilities win when both set the same property. Prefer prefixed VD3 UI utilities (vd-mt-4, vd-col-6) next to Tailwind's own (mt-4, col-span-6). Sync @nuxtjs/color-mode with useThemeBridge and syncDarkClass: true so data-theme and the dark class move together.

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxt/ui', '@nuxtjs/color-mode'],
  css: ['~/assets/css/main.css'],
  colorMode: { classSuffix: '' },
});