Back to InstallationYou are on Vite + Solid.
Installation

Vite + Solid

The Solid items keep their signals and their class-based markup, without a server runtime.

SolidSingle-page appsSolid and TypeScript in a Vite single-page app.

Prerequisites

You need a Vite app with Solid 1, Tailwind CSS v4 and the ~/* alias. Solid projects do not run shadcn init; components.json gives the CLI the aliases it needs.

  • Node.js 20 or newer.
  • Solid with Vite, created by the Solid CLI (the vanilla template).
  • Tailwind CSS v4 through @tailwindcss/vite.
  • The ~/* alias in tsconfig.json and in vite.config.ts.

New app or existing app

Create a Vite app with the Solid 1 and TypeScript template from the official Solid CLI, then install its dependencies. The template keeps its entry in src/index.tsx.

Create a Vite + Solid app

npx create-solid@latest my-app --vanilla --template basic --ts
npmthe default on every machine

Install the dependencies

npm install
npmthe default on every machine

Existing app? Skip the scaffold and start with the configuration section.

Configuration

Add Tailwind to the Vite pipeline, map ~/* to src and create components.json. The Solid items do not need a provider; their motion lives in the installed file.

Install Tailwind CSS v4

npm install tailwindcss @tailwindcss/vite
npmthe default on every machine

Add the Node types used by the alias

npm install @types/node -D
npmthe default on every machine
vite.config.ts
import path from "node:path";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import solid from "vite-plugin-solid";

export default defineConfig({
  plugins: [solid(), tailwindcss()],
  resolve: {
    alias: { "~": path.resolve(__dirname, "./src") },
  },
});
tsconfig.json
{
  "compilerOptions": {
    "jsx": "preserve",
    "jsxImportSource": "solid-js",
    "paths": {
      "~/*": ["./src/*"]
    }
  }
}
components.json
{
  "$schema": "https://ui.shadcn.com/schema.json",
  "style": "default",
  "rsc": false,
  "tsx": true,
  "tailwind": {
    "config": "",
    "css": "src/index.css",
    "baseColor": "neutral",
    "cssVariables": true,
    "prefix": ""
  },
  "aliases": {
    "components": "~/components",
    "utils": "~/lib/utils",
    "ui": "~/components/ui",
    "lib": "~/lib",
    "hooks": "~/hooks"
  },
  "iconLibrary": "lucide"
}
src/index.css
@import "tailwindcss";

@custom-variant dark (&:is(.dark *));

:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}
src/index.tsx
import { render } from "solid-js/web";
import "./index.css";
import App from "./App";

const root = document.getElementById("root");
render(() => <App />, root!);

Add a component

The shadcn CLI fetches the Solid item, writes the file and installs motion and lucide-solid. Import it from the src/components/prequelui folder.

Add the animated component

npx shadcn@latest add https://prequeluianimate.terravidhal.me/r/solid/dialog.json
npmthe default on every machine
src/App.tsx
import { Dialog } from "~/components/prequelui/dialog";

export default function App() {
  return (
    <div class="grid min-h-svh place-items-center">
      <Dialog trigger="Open dialog" title="A Vite + Solid page" />
    </div>
  );
}

Dark mode

Vite serves index.html before the module graph, so the class is in place on the first paint.

index.html
<script>
const saved = localStorage.getItem("theme");
const dark =
saved === "dark" ||
(!saved && matchMedia("(prefers-color-scheme: dark)").matches);
document.documentElement.classList.toggle("dark", dark);
</script>

Verification

Run the dev server, open the page and check the dialog. Then test the theme and reduced motion.

  • The dialog opens on the client without a server render.
  • The theme tokens apply in both modes.
  • Reduced motion keeps the final state without scale or blur.

Start the dev server

npm run dev
npmthe default on every machine

More Solid guides

All frameworks

Built by Vidhal. The source is available on GitHub.

MIT licensed