TailwindCSS
Using the CLI
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.
- npm
- bun
- pnpm
- yarn
npx create-video@latestpnpm create videobun create videoyarn create videoThe following templates support scaffolding with TailwindCSS:
- Blank
- Hello World
- Hello World (JavaScript)
- Audiogram
- Music Visualization
- Prompt to Video
- Overlay
- Stargazer
- TikTok
Installing Tailwind v4 in existing project
from v4.0.256
- Install
@remotion/tailwind-v4package and TailwindCSS dependencies.
- npm
- yarn
- pnpm
- bun
npm i -D @remotion/tailwind-v4 tailwindcssyarn add -D @remotion/tailwind-v4 tailwindcsspnpm i -D @remotion/tailwind-v4 tailwindcssbun i -D @remotion/tailwind-v4 tailwindcss- Add the Webpack override from
@remotion/tailwind-v4to 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()ordeploySite()Node.JS API, add the Webpack override to it as well. -
Create a file
postcss.config.mjswith the following content:
export default {
plugins: {
"@tailwindcss/postcss": {},
},
};- Create a file
src/index.csswith the following content:
@import 'tailwindcss';- Import the stylesheet in your
src/Root.tsxfile. Add to the top of the file:
import './index.css';- Ensure your
package.jsondoes not have"sideEffects": falseset. If it has, declare that CSS files have a side effect:
{
// Only if `"sideEffects": false` exists in your package.json.
- "sideEffects": false
+ "sideEffects": ["*.css"]
}- Start using TailwindCSS! You can verify that it's working by adding
className="bg-red-900"to any element.
Installing Tailwind v3 in existing project
from v3.3.95, see instructions for older versions
- Install
@remotion/tailwindpackage and TailwindCSS dependencies.
- npm
- yarn
- pnpm
- bun
npm i -D @remotion/tailwindyarn add -D @remotion/tailwindpnpm i -D @remotion/tailwindbun i -D @remotion/tailwind- Add the Webpack override from
@remotion/tailwindto your config file:
import {Config } from '@remotion/cli/config';
import {enableTailwind } from '@remotion/tailwind';
Config .overrideWebpackConfig ((currentConfiguration ) => {
return enableTailwind (currentConfiguration );
});Prior to v3.3.39, the option was called Config.Bundling.overrideWebpackConfig().
-
If you use the
bundle()ordeploySite()Node.JS API, add the Webpack override to it as well. -
Create a file
src/style.csswith the following content:
@tailwind base;
@tailwind components;
@tailwind utilities;- Import the stylesheet in your
src/Root.tsxfile. Add to the top of the file:
import './style.css';- Add a
tailwind.config.jsfile to the root of your project:
/* eslint-env node */
module.exports = {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {},
},
plugins: [],
};- Ensure your
package.jsondoes not have"sideEffects": falseset. If it has, declare that CSS files have a side effect:
{
// Only if `"sideEffects": false` exists in your package.json.
- "sideEffects": false
+ "sideEffects": ["*.css"]
}- Start using TailwindCSS! You can verify that it's working by adding
className="bg-red-900"to any element.
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.