Skip to content

Installation

Vite (Vue)

Install newt/ui in a Vue 3 project built with Vite, from the template or into an app you already have.

Choose the brand hue, the radius and the font in newt/create, and it prints a preset code. Pass that code to init and the project comes out already wearing it.

npx newtui@latest init --preset <code> --template vite-vuepnpm dlx newtui@latest init --preset <code> --template vite-vueyarn dlx newtui@latest init --preset <code> --template vite-vuebunx newtui@latest init --preset <code> --template vite-vuedeno run -A npm:newtui@latest init --preset <code> --template vite-vuevlx newtui@latest init --preset <code> --template vite-vuevp dlx newtui@latest init --preset <code> --template vite-vuenubx newtui@latest init --preset <code> --template vite-vuenlx newtui@latest init --preset <code> --template vite-vueupx newtui@latest init --preset <code> --template vite-vue
npx newtui@latest add buttonnpx shadcn@latest add @newtui/buttonnpx shadcn-vue@latest add @newtui/buttonpnpm dlx newtui@latest add buttonpnpm dlx shadcn@latest add @newtui/buttonpnpm dlx shadcn-vue@latest add @newtui/buttonyarn dlx newtui@latest add buttonyarn dlx shadcn@latest add @newtui/buttonyarn dlx shadcn-vue@latest add @newtui/buttonbunx newtui@latest add buttonbunx shadcn@latest add @newtui/buttonbunx shadcn-vue@latest add @newtui/buttondeno run -A npm:newtui@latest add buttondeno run -A npm:shadcn@latest add @newtui/buttondeno run -A npm:shadcn-vue@latest add @newtui/buttonvlx newtui@latest add buttonvlx shadcn@latest add @newtui/buttonvlx shadcn-vue@latest add @newtui/buttonvp dlx newtui@latest add buttonvp dlx shadcn@latest add @newtui/buttonvp dlx shadcn-vue@latest add @newtui/buttonnubx newtui@latest add buttonnubx shadcn@latest add @newtui/buttonnubx shadcn-vue@latest add @newtui/buttonnlx newtui@latest add buttonnlx shadcn@latest add @newtui/buttonnlx shadcn-vue@latest add @newtui/buttonupx newtui@latest add buttonupx shadcn@latest add @newtui/buttonupx shadcn-vue@latest add @newtui/button

The shadcn CLI needs the @newtui registry in your components.json. Set it up.

One command creates the project and wires the tokens into it. --template exists for Next.js, both Vite flavours and Nuxt; everywhere else init runs inside a project you already made.

npx newtui@latest init --template vite-vuepnpm dlx newtui@latest init --template vite-vueyarn dlx newtui@latest init --template vite-vuebunx newtui@latest init --template vite-vuedeno run -A npm:newtui@latest init --template vite-vuevlx newtui@latest init --template vite-vuevp dlx newtui@latest init --template vite-vuenubx newtui@latest init --template vite-vuenlx newtui@latest init --template vite-vueupx newtui@latest init --template vite-vue
npx newtui@latest add buttonnpx shadcn@latest add @newtui/buttonnpx shadcn-vue@latest add @newtui/buttonpnpm dlx newtui@latest add buttonpnpm dlx shadcn@latest add @newtui/buttonpnpm dlx shadcn-vue@latest add @newtui/buttonyarn dlx newtui@latest add buttonyarn dlx shadcn@latest add @newtui/buttonyarn dlx shadcn-vue@latest add @newtui/buttonbunx newtui@latest add buttonbunx shadcn@latest add @newtui/buttonbunx shadcn-vue@latest add @newtui/buttondeno run -A npm:newtui@latest add buttondeno run -A npm:shadcn@latest add @newtui/buttondeno run -A npm:shadcn-vue@latest add @newtui/buttonvlx newtui@latest add buttonvlx shadcn@latest add @newtui/buttonvlx shadcn-vue@latest add @newtui/buttonvp dlx newtui@latest add buttonvp dlx shadcn@latest add @newtui/buttonvp dlx shadcn-vue@latest add @newtui/buttonnubx newtui@latest add buttonnubx shadcn@latest add @newtui/buttonnubx shadcn-vue@latest add @newtui/buttonnlx newtui@latest add buttonnlx shadcn@latest add @newtui/buttonnlx shadcn-vue@latest add @newtui/buttonupx newtui@latest add buttonupx shadcn@latest add @newtui/buttonupx shadcn-vue@latest add @newtui/button

The shadcn CLI needs the @newtui registry in your components.json. Set it up.

Create the app

npm create vite@latest my-app -- --template vue-ts

Add Tailwind

npm install tailwindcss @tailwindcss/vite
@import "tailwindcss";

Declare the alias twice

Once for the type checker, once for the bundler — init reads the first and your build needs the second:

{
  "compilerOptions": {
    "paths": { "@/*": ["./src/*"] }
  }
}
import { fileURLToPath } from "node:url"

import tailwindcss from "@tailwindcss/vite"
import vue from "@vitejs/plugin-vue"
import { defineConfig } from "vite"

export default defineConfig({
  plugins: [vue(), tailwindcss()],
  resolve: {
    alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) },
  },
})

Run init

npx newtui@latest init --framework vue --bundler vitepnpm dlx newtui@latest init --framework vue --bundler viteyarn dlx newtui@latest init --framework vue --bundler vitebunx newtui@latest init --framework vue --bundler vitedeno run -A npm:newtui@latest init --framework vue --bundler vitevlx newtui@latest init --framework vue --bundler vitevp dlx newtui@latest init --framework vue --bundler vitenubx newtui@latest init --framework vue --bundler vitenlx newtui@latest init --framework vue --bundler viteupx newtui@latest init --framework vue --bundler vite

Both flags are guesses it usually makes on its own: the framework comes from your dependencies, the bundler from the presence of a vite.config. Pass them when it guesses wrong.

Load the stylesheet, then add a component

import "./assets/index.css"

.newt-root goes on the element that wraps the application — the <body> in index.html is the usual place.

npx newtui@latest add buttonnpx shadcn@latest add @newtui/buttonnpx shadcn-vue@latest add @newtui/buttonpnpm dlx newtui@latest add buttonpnpm dlx shadcn@latest add @newtui/buttonpnpm dlx shadcn-vue@latest add @newtui/buttonyarn dlx newtui@latest add buttonyarn dlx shadcn@latest add @newtui/buttonyarn dlx shadcn-vue@latest add @newtui/buttonbunx newtui@latest add buttonbunx shadcn@latest add @newtui/buttonbunx shadcn-vue@latest add @newtui/buttondeno run -A npm:newtui@latest add buttondeno run -A npm:shadcn@latest add @newtui/buttondeno run -A npm:shadcn-vue@latest add @newtui/buttonvlx newtui@latest add buttonvlx shadcn@latest add @newtui/buttonvlx shadcn-vue@latest add @newtui/buttonvp dlx newtui@latest add buttonvp dlx shadcn@latest add @newtui/buttonvp dlx shadcn-vue@latest add @newtui/buttonnubx newtui@latest add buttonnubx shadcn@latest add @newtui/buttonnubx shadcn-vue@latest add @newtui/buttonnlx newtui@latest add buttonnlx shadcn@latest add @newtui/buttonnlx shadcn-vue@latest add @newtui/buttonupx newtui@latest add buttonupx shadcn@latest add @newtui/buttonupx shadcn-vue@latest add @newtui/button

The shadcn CLI needs the @newtui registry in your components.json. Set it up.

<script setup lang="ts">
import { Button } from "@/components/ui/button"
</script>

<template>
  <Button variant="primary">Send</Button>
</template>

What init writes

components.json                          the config, shared with shadcn
src/assets/index.css                     the --newt-* token block
src/lib/utils.ts                         cn()
src/components/ui/button/Button.vue      add button
src/components/ui/button/index.ts

A folder per component: the single-file components, and an index.ts barrel that re-exports them with their class-variance-authority variants.

See Dark mode for the theme toggle, and RTL if the app has to run right to left.