Skip to content

Installation

Next.js

Install newt/ui in a Next.js project: where the tokens go, and which components need the client boundary.

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 nextpnpm dlx newtui@latest init --preset <code> --template nextyarn dlx newtui@latest init --preset <code> --template nextbunx newtui@latest init --preset <code> --template nextdeno run -A npm:newtui@latest init --preset <code> --template nextvlx newtui@latest init --preset <code> --template nextvp dlx newtui@latest init --preset <code> --template nextnubx newtui@latest init --preset <code> --template nextnlx newtui@latest init --preset <code> --template nextupx newtui@latest init --preset <code> --template next
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 nextpnpm dlx newtui@latest init --template nextyarn dlx newtui@latest init --template nextbunx newtui@latest init --template nextdeno run -A npm:newtui@latest init --template nextvlx newtui@latest init --template nextvp dlx newtui@latest init --template nextnubx newtui@latest init --template nextnlx newtui@latest init --template nextupx newtui@latest init --template next
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

npx create-next-app@latest my-app --typescript --tailwind --app

Check the aliases

init reads your aliases, it never writes them. create-next-app declares the one that matters:

{
  "compilerOptions": {
    "paths": { "@/*": ["./src/*"] }
  }
}

Run init

npx newtui@latest initpnpm dlx newtui@latest inityarn dlx newtui@latest initbunx newtui@latest initdeno run -A npm:newtui@latest initvlx newtui@latest initvp dlx newtui@latest initnubx newtui@latest initnlx newtui@latest initupx newtui@latest init

It finds app/globals.css first, so the tokens land in the stylesheet your layout already imports.

Put the root class on the body

import "./globals.css"

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body className="newt-root">{children}</body>
    </html>
  )
}

Add a component

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.

import { Button } from "@/components/ui/button"

export default function Page() {
  return <Button variant="primary">Send</Button>
}

Server components

Nine components ship with a "use client" directive — the interactive ones: modal, tabs, toast, reaction, spoiler, form-fields, permission, stage-banner and token-field. The rest render on the server.

Answering yes to the React Server Components question at init keeps those directives. Answering no sets rsc: false in components.json, and add strips them as it writes — which is what a pages-router or client-rendered app wants.

What init writes

components.json                 the config, shared with shadcn
app/globals.css                 the --newt-* token block
lib/utils.ts                    cn()
components/ui/button.tsx        add button

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