---
id: tailwind-integration
title: Tailwind CSS Integration
---
_So you want to use Tailwind CSS in your TanStack Start project?_
This guide will help you use Tailwind CSS in your TanStack Start project.
## Tailwind CSS Version 4 (Latest)
The latest version of Tailwind CSS is 4. And it has some configuration changes that majorly differ from Tailwind CSS Version 3. It's **easier and recommended** to set up Tailwind CSS Version 4 in a TanStack Start project with either Vite or Rsbuild.
### Install Tailwind CSS
Install Tailwind CSS and the integration for your build tool.
# Vite
```shell
npm install tailwindcss @tailwindcss/vite
```
# Rsbuild
```shell
npm install tailwindcss @tailwindcss/postcss postcss
```
### Configure Tailwind CSS
Add Tailwind CSS to your build tool configuration.
# Vite
```ts title="vite.config.ts"
import { defineConfig } from 'vite'
import tsConfigPaths from 'vite-tsconfig-paths'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import tailwindcss from '@tailwindcss/vite'
import viteReact from '@vitejs/plugin-react'
export default defineConfig({
server: {
port: 3000,
},
plugins: [tsConfigPaths(), tanstackStart(), viteReact(), tailwindcss()],
})
```
# Rsbuild
```ts title="rsbuild.config.ts"
import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
export default defineConfig({
server: {
port: 3000,
},
plugins: [pluginReact(), tanstackStart()],
})
```
```js title="postcss.config.mjs"
export default {
plugins: {
'@tailwindcss/postcss': {},
},
}
```
### Import Tailwind in your CSS file
You need to create a CSS file to configure Tailwind CSS instead of the configuration file in version 4. You can do this by creating a `src/styles/app.css` file or name it whatever you want.
```css
/* src/styles/app.css */
@import 'tailwindcss' source('../');
```
## Import the CSS file in your `__root.tsx` file
Import the CSS file in your `__root.tsx` file.
# Vite
Use the `?url` query and make sure to add the **triple slash** directive to the top of the file.
```tsx
// src/routes/__root.tsx
///