- Alert
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- ComboBox
- Command
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Disclosure
- Disclosure Group
- Drawer
- Empty
- Field
- File Trigger
- Form
- Grid List
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- ListBox
- Menu
- Number Field
- Pagination
- Popover
- Progress Bar
- Radio Group
- Range Calendar
- Resizable
- Search Field
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag Group
- Text Field
- Textarea
- Time Field
- Toast
- Toggle Button
- Toggle Button Group
- Tooltip
- Tree
- Typography
Create project
Start by creating a new TanStack Start project by following the Build a Project from Scratch guide on the TanStack Start website.
Do not add Tailwind yet. We'll install Tailwind v4 in the next step.
Add Tailwind
Install tailwindcss and its dependencies.
pnpmnpmyarnbunpnpm add tailwindcss @tailwindcss/postcss postcss
Create postcss.config.ts
Create a postcss.config.ts file at the root of your project.
export default {
plugins: {
"@tailwindcss/postcss": {},
},
}Create app/styles/app.css
Create an app.css file in the app/styles directory and import tailwindcss
@import "tailwindcss" source("../");Import app.css
import type { ReactNode } from "react"
import { createRootRoute, Outlet } from "@tanstack/react-router"
import { Meta, Scripts } from "@tanstack/start"
import appCss from "@/styles/app.css?url"
export const Route = createRootRoute({
head: () => ({
meta: [
{
charSet: "utf-8",
},
{
name: "viewport",
content: "width=device-width, initial-scale=1",
},
{
title: "TanStack Start Starter",
},
],
links: [
{
rel: "stylesheet",
href: appCss,
},
],
}),
component: RootComponent,
})Edit tsconfig.json file
Add the following code to the tsconfig.json file to resolve paths.
{
"compilerOptions": {
"jsx": "react-jsx",
"moduleResolution": "Bundler",
"module": "ESNext",
"target": "ES2022",
"skipLibCheck": true,
"strictNullChecks": true,
"baseUrl": ".",
"paths": {
"@/*": ["./app/*"]
}
}
}Run the CLI
Run the shadcn init command to setup your project:
pnpmnpmyarnbunpnpm dlx shadcn@canary init
This will create a components.json file in the root of your project and configure CSS variables inside app/styles/app.css.
That's it
You can now start adding components to your project.
pnpmnpmyarnbunpnpm dlx shadcn@canary add button
The command above will add the Button component to your project. You can then import it like this:
import { Button } from "@/components/ui/button"
function Home() {
const router = useRouter()
const state = Route.useLoaderData()
return (
<div>
<Button>Click me</Button>
</div>
)
}