Skip to content

Getting Started

[01] Getting Started

Installation

Install @vaneui/ui with npm, yarn or pnpm, add its CSS through Tailwind CSS v4 or the prebuilt bundle, and wrap your React app in ThemeProvider.

Edit this page

Install VaneUI, a React component library built with TypeScript and Tailwind CSS, using your preferred package manager:

npm install @vaneui/ui
yarn add @vaneui/ui
pnpm add @vaneui/ui

CSS setup

VaneUI supports two CSS setup options depending on your project configuration. Use one of them, not both: @vaneui/ui/css (Option 2) already contains everything in @vaneui/ui/vars (Option 1), so a project that imports both ships the variables and component rules twice.

Option 1: with Tailwind CSS (recommended)

If your project uses Tailwind CSS v4, VaneUI plugs in directly. Tailwind scans VaneUI components and generates only the CSS classes you use.

Tailwind CSS v4 runs as a plugin of your build tool, so a project needs the tailwindcss package plus one of two plugins. Skip this step if Tailwind already builds your CSS.

For a build that runs PostCSS (Next.js, for example), install @tailwindcss/postcss:

npm install -D tailwindcss @tailwindcss/postcss

Then register the plugin in postcss.config.mjs at the project root:

const config = {
plugins: {
'@tailwindcss/postcss': {},
},
};
export default config;

For a Vite project, install @tailwindcss/vite:

npm install -D tailwindcss @tailwindcss/vite

Then add it to the plugins array in vite.config.ts:

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [react(), tailwindcss()],
});

With the plugin in place, add the following to your main CSS file:

@import "tailwindcss";
@import "@vaneui/ui/tokens";
@import "@vaneui/ui/vars";
@source "../node_modules/@vaneui/ui";

This setup:

  • Imports Tailwind CSS base styles
  • Imports VaneUI theme tokens (registers custom breakpoints and design tokens with Tailwind)
  • Imports VaneUI CSS variables and component rules
  • Tells Tailwind to scan VaneUI components for class generation

The @source path is relative to the CSS file that contains it, not to the project root. ../node_modules/@vaneui/ui fits a stylesheet one folder below the root, such as app/globals.css or src/index.css. From src/app/globals.css, write ../../node_modules/@vaneui/ui. A wrong path does not fail the build: Tailwind finds no VaneUI files and does not generate the utility classes the components use, so they render without their layout, spacing and colors.

The @vaneui/ui/tokens import is required for responsive props like mobileStack, tabletHide, and responsive typography to work. It registers VaneUI's custom breakpoints (mobile, tablet, desktop) with your project's Tailwind CSS instance.

Option 2: without Tailwind CSS

If your project doesn't use Tailwind CSS, you can import VaneUI's pre-built CSS bundle which includes all component styles.

Add the following to your main CSS file:

@import "@vaneui/ui/css";

This setup:

  • Imports the complete pre-built VaneUI stylesheet (component styles and CSS variables in one file)
  • Works without any Tailwind configuration

Do not add @import "@vaneui/ui/vars" next to it. The pre-built file already contains the variables and component rules.

The pre-built stylesheet is compiled for VaneUI's own components; it does not contain Tailwind's full utility set. A Tailwind class passed through className or extraClasses has no effect unless it happens to be in the bundle, and most (max-w-md, p-6, size-8, ms-auto, z-40) are not. For arbitrary utilities, use Option 1 or the style prop.

ThemeProvider setup

Wrap your application in ThemeProvider. Without it, each component falls back to its own built-in default theme, but themeDefaults, extraClasses, and themeOverride only apply inside a provider. Place it once at the root, above every VaneUI component.

import { ThemeProvider } from '@vaneui/ui';
function Root() {
return (
<ThemeProvider>
<App />
</ThemeProvider>
);
}

ThemeProvider needs no props to apply the built-in defaults. To set application-wide defaults, extra classes, or theme overrides, see Using ThemeProvider.

For a Next.js App Router project, see Next.js, and for a Vite project, see Vite. To render Markdown with VaneUI components, see Markdown Rendering. To connect an AI coding assistant through the MCP server, llms.txt or the Markdown copy of each page, see AI Assistants.

Usage

Start using VaneUI components in your React application:

import { Button, Stack } from '@vaneui/ui';
function App() {
return (
<Stack>
<Button primary>Get Started</Button>
</Stack>
);
}

Per-component imports

For better tree-shaking, you can import components directly:

import { Button } from '@vaneui/ui/button';
import { Card } from '@vaneui/ui/card';
import { useTheme } from '@vaneui/ui/theme';

This is optional. Importing from @vaneui/ui works the same way. Per-component imports can reduce bundle size when using only a few components with bundlers that don't fully tree-shake barrel exports.

Available subpath imports include: @vaneui/ui/button, @vaneui/ui/iconButton, @vaneui/ui/icon, @vaneui/ui/badge, @vaneui/ui/card, @vaneui/ui/checkbox, @vaneui/ui/chip, @vaneui/ui/code, @vaneui/ui/divider, @vaneui/ui/img, @vaneui/ui/input, @vaneui/ui/kbd, @vaneui/ui/label, @vaneui/ui/mark, @vaneui/ui/menu, @vaneui/ui/modal, @vaneui/ui/navLink, @vaneui/ui/overlay, @vaneui/ui/popup, @vaneui/ui/section, @vaneui/ui/container, @vaneui/ui/row, @vaneui/ui/col, @vaneui/ui/stack, @vaneui/ui/grid, @vaneui/ui/typography, @vaneui/ui/layout, @vaneui/ui/theme, @vaneui/ui/props.

@vaneui/ui 1.6.0 adds @vaneui/ui/alert, @vaneui/ui/field, @vaneui/ui/progress, @vaneui/ui/radio, @vaneui/ui/select, @vaneui/ui/spinner, @vaneui/ui/switch, @vaneui/ui/textarea and @vaneui/ui/tooltip.