Skip to content

Elements: Split timed captions element - #10060

Merged
samohovets merged 4 commits into
remotion-dev:mainfrom
yuanran32:main
Aug 3, 2026
Merged

Elements: Split timed captions element#10060
samohovets merged 4 commits into
remotion-dev:mainfrom
yuanran32:main

Conversation

@yuanran32

@yuanran32 yuanran32 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #9826
This PR splits the existing timed captions Element into three standalone Elements:

  • text/timed-captions-highlight
  • text/timed-captions-scale
  • text/timed-captions-background

Each caption style now has its own public component, Element metadata entry, documentation page, and installable source file instead of being selected through a shared mode prop.

Changes

  • Removed the old combined timed-captions Element API.
  • Added separate Elements for the highlight, scale, and background caption styles.
  • Updated the Elements sidebar and Element definitions.
  • Updated tests to cover the new timed captions Element slugs.
  • Removed the hardcoded style.translate positioning from the default example.
  • Centered the caption layer using CSS layout instead.

Tradeoffs

The three Elements intentionally keep their implementation self-contained instead of sharing local helper files. This adds some duplication, but keeps each Element independently installable from the Elements library without requiring extra local source dependencies.

Testing

  • git diff --cached --check
  • Static validation script for:
    • Element filesystem slugs matching element-definitions.ts
    • timed captions slugs being exactly the three new variants
    • no remaining old mode API markers
    • no remaining hardcoded translate: '109.5px -36px'
    • declared dependencies matching imports

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview Aug 3, 2026 9:28am
remotion Ready Ready Preview Aug 3, 2026 9:28am

Request Review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — a clean split of the TimedCaptions element into three standalone Elements, each with its own component, schema, metadata, and docs page.

  • Removed the combined text/timed-captions Element — old index.mdx deleted, old entry dropped from element-definitions.ts and elements-sidebars.ts.
  • Added TimedCaptionsBackground — stripped the mode prop and removed the highlight-color and scale-animation branches; kept the pill-background layout and interpolate/spring animation for the sliding pill.
  • Added TimedCaptionsHighlight — standalone variant with word-level color highlight only (no scale animation, no pill background).
  • Added TimedCaptionsScale — standalone variant with word-level color change + spring/interpolate scale animation (getTokenScale), plus fps-aware fontSize that accounts for activeWordScale.
  • Updated element definitions — three new entries with correct preview URLs, dependency lists, display names, and slugs.
  • Updated tests — converted the single-element OG video metadata test into a full loop over all definitions; added a timed-caption-specific test that asserts exactly three slugs exist, verifies each has a production filesystem entry, and confirms no stale mode/TimedCaptionsMode/hardcoded translate markers remain.

All 123 element tests pass.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Claude Opus not used — the program covers this model; add its provider key to run your pick) | 𝕏

@samohovets

Copy link
Copy Markdown
Member

Thanks!

@samohovets
samohovets merged commit bf293f6 into remotion-dev:main Aug 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remotion Elements: Split Timed Captions into three Elements

2 participants