packages/docs/docs/tailwind.mdx
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import {TailwindSupport} from '../components/TailwindSupport';
The easiest way to get started with Tailwind is by scaffolding a new video using the CLI and selecting a template that supports adding Tailwind automatically.
<Tabs defaultValue="npm" values={[ { label: 'npm', value: 'npm', }, { label: 'bun', value: 'bun', }, { label: 'pnpm', value: 'pnpm', }, { label: 'yarn', value: 'yarn', }, ] }> <TabItem value="npm">
npx create-video@latest
pnpm create video
bun create video
yarn create video
The following templates support scaffolding with TailwindCSS: <TailwindSupport />
from v4.0.256
@remotion/tailwind-v4 package and TailwindCSS dependencies.<Tabs defaultValue="npm" values={[ { label: 'npm', value: 'npm', }, { label: 'yarn', value: 'yarn', }, { label: 'pnpm', value: 'pnpm', }, { label: 'bun', value: 'bun', }, ] }> <TabItem value="npm">
npm i -D @remotion/tailwind-v4 tailwindcss
yarn add -D @remotion/tailwind-v4 tailwindcss
pnpm i -D @remotion/tailwind-v4 tailwindcss
bun i -D @remotion/tailwind-v4 tailwindcss
@remotion/tailwind-v4 to your config file:import {Config} from '@remotion/cli/config';
import {enableTailwind} from '@remotion/tailwind-v4';
Config.overrideWebpackConfig((currentConfiguration) => {
return enableTailwind(currentConfiguration);
});
If you use the bundle() or deploySite() Node.JS API, add the Webpack override to it as well.
Create a file src/index.css with the following content:
@import 'tailwindcss';
src/Root.tsx file. Add to the top of the file:import './index.css';
package.json does not have "sideEffects": false set. If it has, declare that CSS files have a side effect:{
// Only if `"sideEffects": false` exists in your package.json.
- "sideEffects": false
+ "sideEffects": ["*.css"]
}
className="bg-red-900" to any element.from v3.3.95, see instructions for older versions
@remotion/tailwind package and TailwindCSS dependencies.<Tabs defaultValue="npm" values={[ { label: 'npm', value: 'npm', }, { label: 'yarn', value: 'yarn', }, { label: 'pnpm', value: 'pnpm', }, { label: 'bun', value: 'bun', }, ] }> <TabItem value="npm">
npm i -D @remotion/tailwind
yarn add -D @remotion/tailwind
pnpm i -D @remotion/tailwind
bun i -D @remotion/tailwind
@remotion/tailwind to your config file:import {Config} from '@remotion/cli/config';
import {enableTailwind} from '@remotion/tailwind';
Config.overrideWebpackConfig((currentConfiguration) => {
return enableTailwind(currentConfiguration);
});
:::note
Prior to v3.3.39, the option was called Config.Bundling.overrideWebpackConfig().
:::
If you use the bundle() or deploySite() Node.JS API, add the Webpack override to it as well.
Create a file src/style.css with the following content:
@tailwind base;
@tailwind components;
@tailwind utilities;
src/Root.tsx file. Add to the top of the file:import './style.css';
tailwind.config.js file to the root of your project:/* eslint-env node */
module.exports = {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {},
},
plugins: [],
};
package.json does not have "sideEffects": false set. If it has, declare that CSS files have a side effect:{
// Only if `"sideEffects": false` exists in your package.json.
- "sideEffects": false
+ "sideEffects": ["*.css"]
}
className="bg-red-900" to any element.:::note
Your package manager might show a peer dependency warning. You can safely ignore it or add strict-peer-dependencies=false to your .npmrc to suppress it.
:::