Vite
Install and configure Solid UI for Vite.
Choose the setup that matches your starting point.
Create a Solid 2 app with Tailwind CSS and set up Solid UI.
Add Solid UI to a Solid 2 app you already created.
New Project
Create Project
Create a Solid 2 app with create-solid:
Choose Solid 2.0, TypeScript and the with-tailwindcss template when it asks:
◇ What type of project would you like to create?
│ Solid 2.0
│
◇ Use Typescript?
│ Yes
│
◇ Which template would you like to use?
│ with-tailwindcssRun the CLI
Run init in the project folder. It installs the project’s dependencies with the package manager you run it with, so you can skip the install step create-solid suggests.
To start from a preset you built on the Create page, pass its code with --preset.
Add Components
Add the Card component to your project:
The command above adds the Card component to your project. You can then import it like this:
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle
} from "~/components/ui/card"
export default function Home() {
return (
<Card class="max-w-sm">
<CardHeader>
<CardTitle>Project Overview</CardTitle>
<CardDescription>
Track progress and recent activity for your Vite app.
</CardDescription>
</CardHeader>
<CardContent>
Your design system is ready. Start building your next component.
</CardContent>
</Card>
)
}Existing Project
Open Your Project
Open a terminal in the root of your Solid 2 app. Solid UI needs Vite with @solidjs/vite-plugin and TypeScript.
Add Tailwind CSS
If your project already has Tailwind CSS configured, skip this step.
Add the Tailwind CSS plugin to vite.config.ts:
import solid from "@solidjs/vite-plugin"
import tailwindcss from "@tailwindcss/vite"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [solid(), tailwindcss()]
})Import Tailwind CSS at the top of your app stylesheet, for example src/App.css:
@import "tailwindcss";Run the CLI
Run init to set up Solid UI in your project:
It adds the ~/* alias to tsconfig.json and resolve.tsconfigPaths to vite.config.ts, so Vite resolves the component imports. If Vite still can’t, see Fix unresolved imports.
Add Components
Add the Card component to your project:
The command above adds the Card component to your project. You can then import it like this:
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle
} from "~/components/ui/card"
export default function App() {
return (
<Card class="max-w-sm">
<CardHeader>
<CardTitle>Project Overview</CardTitle>
<CardDescription>
Track progress and recent activity for your Vite app.
</CardDescription>
</CardHeader>
<CardContent>
Your design system is ready. Start building your next component.
</CardContent>
</Card>
)
}