tailwind
heygen-com/hyperframes
Tailwind CSS v4.2 browser-runtime patterns for HyperFrames video compositions.
What is tailwind?
This skill provides patterns and guardrails for using Tailwind CSS v4.2 browser runtime in HyperFrames compositions. Use it when scaffolding or editing projects created with `hyperframes init --tailwind`, writing utility classes, defining CSS-first theme tokens, migrating from v3 syntax, or deciding between browser runtime and compiled CSS.
- Write Tailwind v4 utility classes in composition HTML with deterministic rendering
- Define CSS-first theme tokens and custom utilities using @theme and @utility blocks
- Debug v3 vs v4 syntax differences and migrate existing Tailwind patterns
- Use CSS custom properties and data attributes for dynamic styling without runtime class generation
- Apply video-specific guardrails: stable dimensions, transforms, opacity, and explicit border colors
- Validate compositions with `npx hyperframes lint`, `validate`, and `render` commands
How to install tailwind
npx skills add https://github.com/heygen-com/hyperframes --skill tailwind- Project created with `hyperframes init --tailwind`
- @tailwindcss/browser@4.2.4 pinned in the composition
- window.__tailwindReady shim present in index.html
How to use tailwind
- 1.Confirm your project was scaffolded with `hyperframes init --tailwind` and contains the pinned Tailwind browser runtime script
- 2.Replace any v3 @tailwind directives (base, components, utilities) with v4 CSS-first @theme and @utility blocks in <style type="text/tailwindcss"> tags
- 3.Define custom colors, fonts, and spacing using @theme { --color-brand: ...; --font-display: ...; } instead of tailwind.config.js
- 4.Use complete static class names in HTML; avoid building class names dynamically at render time (e.g., avoid `bg-${color}-500`)
- 5.For repeated items, use CSS custom properties and data attributes: `<div style="--i: 0" class="translate-y-[calc(var(--i)*6px)]"></div>`
- 6.Apply video-specific patterns: use w-[...], h-[...], aspect-video, flex, grid for layout; prefer transforms and opacity for animation; avoid hover/focus/scroll variants
- 7.Run `npx hyperframes validate` and `npx hyperframes render . --workers 1 --quality draft` to verify styles render deterministically before frame 0
Use cases
- Building video layouts with stable dimensions and render-deterministic Tailwind classes
- Adding custom brand colors and typography tokens via @theme instead of tailwind.config.js
- Migrating v3 @tailwind directives to v4 browser-runtime CSS patterns
- Styling repeated animation elements using CSS custom properties instead of dynamic class names
- Debugging missing styles in rendered frames by confirming window.__tailwindReady resolution
- HyperFrames developers building video compositions with Tailwind styling
- Teams migrating from Tailwind v3 to v4 browser runtime
- Video engineers needing deterministic, frame-accurate CSS rendering
- Developers working with `hyperframes init --tailwind` scaffolded projects
tailwind FAQ
Always use the pinned @tailwindcss/browser@4.2.4 injected by the CLI. Do not replace it with cdn.tailwindcss.com. The pinned version ensures deterministic rendering and waits for window.__tailwindReady before frame capture.
No. Do not add tailwind.config.js for v4 browser-runtime compositions. Instead, define colors, fonts, spacing, and utilities directly in a <style type="text/tailwindcss"> block using @theme and @utility. If you need an existing JavaScript config for a compiled v4 build, load it explicitly with @config and validate in the browser.
Use complete static class names in HTML and CSS custom properties for variation. For example, use `<div data-tone="blue" class="bg-blue-500 data-[tone=rose]:bg-rose-500"></div>` instead of building `bg-${color}-500` dynamically. Tailwind's browser runtime scans the document for visible class names; dynamically generated classes may not be included before frame capture.
v4 is CSS-first: use @theme and @utility in <style type="text/tailwindcss"> blocks instead of @tailwind directives. Default border behavior changed; use explicit colors like `border border-white/20`. Utility names changed: `shadow-xs`, `rounded-xs`, `outline-hidden`, `shrink-*`, and `grow-*` are v4 names. Avoid hover, focus, scroll, and pointer variants for deterministic video rendering.
Run `npx hyperframes lint`, `npx hyperframes validate`, and `npx hyperframes inspect`. Confirm window.__tailwindReady exists and resolves before capture. Check that the Tailwind browser runtime script is pinned to @tailwindcss/browser@4.2.4. Verify all class names are static and visible in the HTML. For offline or production-stable renders, compile Tailwind to CSS and include the stylesheet directly instead of using the browser runtime.
Full instructions (SKILL.md)
Source of truth, from heygen-com/hyperframes.
name: tailwind
description: Tailwind CSS v4.2 browser-runtime patterns for HyperFrames compositions. Use when scaffolding or editing projects created with hyperframes init --tailwind, writing Tailwind utility classes in composition HTML, adding CSS-first Tailwind v4 theme tokens, debugging v3 vs v4 syntax, or deciding when to compile Tailwind to CSS instead of using the browser runtime.
Tailwind CSS for HyperFrames
HyperFrames init --tailwind uses the Tailwind browser runtime pinned to @tailwindcss/browser@4.2.4. Treat that as Tailwind v4, not v3.
This skill is for composition HTML generated by the CLI. It is not for packages/studio, which still uses Tailwind v3 internally with tailwind.config.js, PostCSS, and @tailwind directives.
When To Use
- The user asks for Tailwind in a HyperFrames composition.
- A project was created with
hyperframes init --tailwind. - You see
window.__tailwindReadyinindex.html. - You need utility classes, CSS-first theme tokens, custom utilities, or v3-to-v4 migration guidance.
- The render has missing styles and the project is relying on the browser runtime.
Version Contract
- Pinned runtime:
@tailwindcss/browser@4.2.4. - Browser runtime script is injected by the CLI. Do not replace it with
cdn.tailwindcss.com. - HyperFrames waits for
window.__tailwindReadybefore frame capture starts. - The readiness shim must stay deterministic: no render-loop polling APIs, no clock-based retries, no runtime network fetches beyond the pinned Tailwind runtime script.
- For offline, locked-down, or production-stable renders, compile Tailwind to CSS and include the stylesheet directly instead of relying on the browser runtime.
v4 Rules
Tailwind v4 is CSS-first:
<style type="text/tailwindcss">
@theme {
--color-brand: oklch(0.68 0.2 252);
--font-display: "Inter", sans-serif;
}
@utility headline-balance {
text-wrap: balance;
letter-spacing: 0;
}
</style>
Avoid v3 setup patterns in browser-runtime compositions:
/* Do not use these in Tailwind v4 browser-runtime compositions. */
@tailwind base;
@tailwind components;
@tailwind utilities;
Do not add a tailwind.config.js just to define colors, fonts, spacing, or utilities for a v4 browser-runtime composition. Use @theme and @utility in a text/tailwindcss style block.
If you truly need an existing JavaScript config for a compiled v4 build, load it explicitly from CSS with @config, then validate in the browser. Do not assume v4 auto-detects v3 config files.
HyperFrames Composition Pattern
Keep Tailwind responsible for static layout and visual style. Keep motion timing in GSAP or another seekable adapter.
<section
class="clip absolute inset-0 grid place-items-center bg-zinc-950 text-white"
data-start="0"
data-duration="5"
data-track-index="1"
>
<div class="w-[1280px] max-w-[82vw] text-center">
<p class="mb-6 text-xl font-medium uppercase tracking-[0.18em] text-cyan-300">
Render-ready Tailwind
</p>
<h1 class="text-7xl font-black leading-none text-balance">
Utility classes, deterministic frames.
</h1>
</div>
</section>
For repeated items, prefer class lists plus CSS custom properties over generating class names dynamically:
<span class="inline-block translate-y-[calc(var(--i)*6px)] opacity-80" style="--i: 0"></span>
<span class="inline-block translate-y-[calc(var(--i)*6px)] opacity-80" style="--i: 1"></span>
<span class="inline-block translate-y-[calc(var(--i)*6px)] opacity-80" style="--i: 2"></span>
Dynamic Class Safety
Tailwind's browser runtime scans the current document and generates CSS for class names it can see. Do not build render-critical class names only at seek time:
// Risky: Tailwind may not see every generated class before capture.
element.className = `bg-${color}-500`;
Use complete class names in HTML, data attributes, or explicit CSS instead:
<div data-tone="blue" class="bg-blue-500 data-[tone=rose]:bg-rose-500"></div>
If a generated class is unavoidable, make sure the full class token appears in a text/tailwindcss block before validation.
Video-Specific Guardrails
- Use stable dimensions:
w-[...],h-[...],aspect-video,grid,flex, and fixed padding for video layouts. - Prefer transforms and opacity for animated properties.
- Keep Tailwind transitions out of render-critical timing unless a seekable runtime owns the state.
- Avoid hover, focus, scroll, viewport, or pointer variants for content that must render deterministically.
- Use explicit border colors. Tailwind v4 changed the default border behavior from v3, so
border border-white/20is safer than bareborder. - Use v4 utility names:
shadow-xs,rounded-xs,outline-hidden,shrink-*, andgrow-*where those replacements apply. - Be careful with modern CSS utilities if the output needs older browser support. Tailwind v4 targets modern browsers.
Validation
After editing a Tailwind-enabled composition:
npx hyperframes lint
npx hyperframes validate
npx hyperframes inspect
For a render proof:
npx hyperframes render . --workers 1 --quality draft --output tailwind-proof.mp4
The validation path should show no missing-style flashes on frame 0. If styles appear in preview but not render, check that window.__tailwindReady exists and resolves before capture.
Quick Debug Checklist
- Confirm the project was scaffolded with
hyperframes init --tailwind. - Confirm the script points to
@tailwindcss/browser@4.2.4. - Confirm
window.__tailwindReadyis present. - Replace v3
@tailwinddirectives with v4 browser-runtime CSS. - Move custom tokens from
tailwind.config.jsto@theme. - Replace dynamically assembled classes with complete static tokens.
- Run
npx hyperframes validateand render a short proof.
Credits And References
- Tailwind CSS official v4 installation, upgrade, and compatibility docs: https://tailwindcss.com/docs
- Tailwind CSS v4 release notes: https://tailwindcss.com/blog/tailwindcss-v4
- Community Tailwind skills were reviewed for v4 gotchas and skill shape, but this skill keeps the durable contract in-repo and HyperFrames-specific.
Related skills
More from heygen-com/hyperframes and the wider catalog.
hyperframes
Router and entry skill for video authoring—renders video from HTML with intent-based workflow selection.
hyperframes-cli
CLI for HyperFrames video composition: scaffold, lint, validate, render locally or on AWS Lambda.
hyperframes-registry
Install and wire reusable blocks and components into HyperFrames compositions via registry.
remotion-to-hyperframes
Port existing Remotion (React) video compositions to HyperFrames HTML—one-way translation only.
hyperframes-media
Audio and media engine for HyperFrames: TTS, background music, sound effects, transcription, captions, and background removal.
gsap
GSAP animation reference for HyperFrames compositions with timelines, easing, and performance optimization.