🎥 Make videos programmatically with React
Skills: Prefer connected interactive components with direct timing
Jonny Burgere6f3b97d05f1
diff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.mdindex 5ae27340c9..ca060a06fc 100644--- a/packages/skills/skills/remotion-interactivity/SKILL.md+++ b/packages/skills/skills/remotion-interactivity/SKILL.md@@ -13,6 +13,118 @@ By writing Remotion markup in a specific way, the Remotion Studio is able to recIf the markup is too complex for the Studio to make it interactive, then the values become grayed out.+## Prefer interactive components with their own timelines++Use `Interactive.withSchema({wrapInSequence: true})` for custom scenes, cards,+titles, and other visual components whose props should be editable per instance.+Expose meaningful content and appearance controls in an `InteractivitySchema`.+Keep decorative implementation details inside the component.++The component must accept `style` and forward it to one visual root. Keep a+shared root when transforms, cropping, or opacity should affect all its layers.+Flatten redundant inner wrappers when their styles can move onto an existing+element without changing layout or animation.++```tsx title="Chapter.tsx"+import type React from 'react';+import {AbsoluteFill, Interactive, type InteractivitySchema} from 'remotion';++type ChapterProps = {+ readonly title: string;+ readonly style?: React.CSSProperties;+};++const ChapterInner: React.FC<ChapterProps> = ({title, style}) => (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ backgroundColor: 'white',+ fontSize: 64,+ ...style,+ }}+ >+ {title}+ </AbsoluteFill>+);++const chapterSchema = {+ title: {type: 'text-content', default: '', description: 'Title'},+} as const satisfies InteractivitySchema;++export const Chapter = Interactive.withSchema({+ Component: ChapterInner,+ componentName: '<Chapter>',+ schema: chapterSchema,+ wrapInSequence: true,+});+```++Forwarding the injected `style` inside the component is required; keep editable+styles inline at the component's call site.++### Register reusable components as connected compositions++Register substantial scenes and reusable components with their own layers or+animation as standalone compositions. Studio calls these **connected+compositions**: they can be opened in their own timeline while sharing the same+component implementation with the parent video.++Register the same exported component reference that the parent renders. For the+example above, use `component={Chapter}`, not `ChapterInner` or an inline wrapper.+With `wrapInSequence: true`, no extra `<Sequence>` is needed for the connection.++```tsx title="Root.tsx"+import {Composition} from 'remotion';+import {Chapter} from './Chapter';++export const RemotionRoot = () => (+ <Composition+ id="Chapter"+ component={Chapter}+ width={1920}+ height={1080}+ fps={30}+ durationInFrames={90}+ defaultProps={{title: 'Introduction'}}+ />+);+```++Choose a unique ID, representative inline defaults, and dimensions, fps, and+duration suitable for previewing the component. Registration defaults do not+automatically copy props from a parent instance. See+[connected compositions](../remotion-markup/connected-compositions.md) for+registration and extraction details.++### Put timing directly on the component++Avoid a separate `<Sequence>` around one component that already accepts timing+props. Built-in interactive components and custom components made with+`wrapInSequence: true` can receive `name`, `from`, `durationInFrames`,+`trimBefore`, `playbackRate`, and `premountFor` directly.++```tsx+<Chapter+ name="Opening chapter"+ from={30}+ durationInFrames={90}+ title="Introduction"+/>+```++When removing a redundant sequence, move its timing and name to the child.+Preserve any existing child timing; do not overwrite or double-apply offsets.+A `useCurrentFrame()` call inside the component reads its local frame, while a+style expression at the call site still uses the caller's frame. Preserve that+distinction when moving animation styles.++Keep a `<Sequence>` when it provides shared timing for multiple siblings,+overrides dimensions for `useVideoConfig()`, or wraps a component that does not+handle timing. Keep `<Series.Sequence>` for consecutive layout and+`<TransitionSeries.Sequence>` for transitions; direct `from` props do not+replace those behaviors.+## Give every independently editable item its own JSX nodeThe Studio edits the JSX source node that created an item. If multiple runtime@@ -84,9 +196,9 @@ Avoid computed names, hardcode them.</Interactive.Div><Img name="Avatar" src="https://remotion.media/image.jpeg" /><Video name="Background" src="https://remotion.media/video.mp4" />- <Sequence name="Title">+ <Interactive.Div name="Title">Launch day- </Sequence>+ </Interactive.Div></>```diff --git a/packages/skills/skills/remotion-markup/SKILL.md b/packages/skills/skills/remotion-markup/SKILL.mdindex a63d4a04cc..6a53283b07 100644--- a/packages/skills/skills/remotion-markup/SKILL.md+++ b/packages/skills/skills/remotion-markup/SKILL.md@@ -21,7 +21,12 @@ Tailwind animation class will not render correctly, they need to be refactored.Use `Easing.bezier()` and `Easing.spring()` to customize timing.-Structure your markup according to [Remotion Interactivity Best Practices](../remotion-interactivity/SKILL.md)+Structure your markup according to [Remotion Interactivity Best Practices](../remotion-interactivity/SKILL.md).+Prefer `Interactive.withSchema({wrapInSequence: true})` for custom visual components+with editable props, and register reusable scenes as connected compositions.+Put timing directly on components that support it; avoid redundant `<Sequence>`+wrappers. Keep sequences where they provide grouping, dimension overrides, or+series/transition behavior.The Studio edits the JSX source node that created an item. Author everycomposition registration, clip, scene, layer and sequence that should be@@ -259,9 +264,9 @@ See [multi-scene-video.md](multi-scene-video.md) if planning to make a video witWhen a scene or group of layers deserves its own editable timeline, follow [connected-compositions.md](connected-compositions.md). Prefer this structure for substantial scenes in a multi-scene video.-For a Studio request such as `Pre-compose Ambient glow (src/BarChart.tsx:134)`, find the selected sequence markup at the given location. Make a connected composition, following [connected-compositions.md](connected-compositions.md): extract the markup into a named component, render one direct instance of it as the only child of a `<Sequence>`, `<Series.Sequence>`, or `<TransitionSeries.Sequence>`, and register that same component reference with a unique `<Composition>` in the root. If the selected node is already a sequence, keep its props and extract its children. The registration needs dimensions, fps, duration, and `defaultProps` equivalent to its parent use. A component extraction without a registered composition does not complete a pre-compose request.+For a Studio request such as `Pre-compose Ambient glow (src/BarChart.tsx:134)`, find the selected sequence markup at the given location. Make a connected composition, following [connected-compositions.md](connected-compositions.md): extract the markup into a named component, preferably make it interactive with `Interactive.withSchema({wrapInSequence: true})`, and register the same exported component reference with a unique `<Composition>` in the root. Render the interactive component directly with its timing props, or as the only child of a sequence when that wrapper has a purpose. If the selected node is already a sequence, keep its props and extract its children. The registration needs dimensions, fps, duration, and `defaultProps` equivalent to its parent use. A component extraction without a registered composition does not complete a pre-compose request.-The extracted component may return a fragment; do not add a DOM wrapper. Preserve sibling order, props, keys, conditional rendering, dimensions, appearance, and timing. Trace values used by the selected markup: move their derivations only when the same scope and lifecycle are preserved, otherwise pass them as props. In particular, moving `useCurrentFrame()` or `useVideoConfig()` across a sequence boundary can change its result; pass the parent value when needed. If the selection or a behavior-preserving connected composition is unclear, ask for clarification instead of guessing.+A component using `withSchema()` must forward its injected `style` to one visual root; reuse an existing root where possible. A plain component kept inside an explicit sequence may return a fragment. Preserve sibling order, props, keys, conditional rendering, dimensions, appearance, and timing. Trace values used by the selected markup: move their derivations only when the same scope and lifecycle are preserved, otherwise pass them as props. In particular, moving `useCurrentFrame()` or `useVideoConfig()` across a sequence boundary can change its result; pass the parent value when needed. If the selection or a behavior-preserving connected composition is unclear, ask for clarification instead of guessing.## Voiceoverdiff --git a/packages/skills/skills/remotion-markup/connected-compositions.md b/packages/skills/skills/remotion-markup/connected-compositions.mdindex 4632b02ec5..3b4b7c2de2 100644--- a/packages/skills/skills/remotion-markup/connected-compositions.md+++ b/packages/skills/skills/remotion-markup/connected-compositions.md@@ -5,30 +5,19 @@ Using the connected compositions pattern, a group of layers can get their own StUse connected composition when a section has its own layers or timing, will be reused, or would be easier to edit and preview on its own.1. Put the scene's markup in a named React component. Multiple internal layers and sequences can live inside it.-2. Render exactly one direct instance of that component inside a `<Sequence>`, `<Series.Sequence>`, or `<TransitionSeries.Sequence>` in the parent.+2. Prefer making the component interactive with `Interactive.withSchema({wrapInSequence: true})`, following [Remotion Interactivity](../remotion-interactivity/SKILL.md). Render the exported component directly in the parent with inline timing and editable props. It does not need an additional `<Sequence>` to connect to its registration. For consecutive scenes or transitions, render one direct instance as the only child of a `<Series.Sequence>` or `<TransitionSeries.Sequence>`. An explicit `<Sequence>` remains useful for components that do not handle timing or need dimension overrides.3. Register the **same component reference** with `<Composition component={...}>` in the root. Give it a unique `id` and the dimensions, fps, and natural duration needed to preview the scene on its own. A `<Folder>` can keep scene compositions together.```tsx// MyVideo.tsx-import {Series} from 'remotion';-import {OpeningScene} from './OpeningScene';-import {FeatureScene} from './FeatureScene';+import {Chapter} from './Chapter';+// Chapter is the exported Interactive.withSchema({wrapInSequence: true}) component.export const MyVideo = () => (- <Series>- <Series.Sequence- name="Opening"- durationInFrames={90}- >- <OpeningScene />- </Series.Sequence>- <Series.Sequence- name="Feature"- durationInFrames={120}- >- <FeatureScene />- </Series.Sequence>- </Series>+ <>+ <Chapter name="Opening" durationInFrames={90} title="Introduction" />+ <Chapter name="Feature" from={90} durationInFrames={120} title="New features" />+ </>);```@@ -36,27 +25,19 @@ export const MyVideo = () => (// Root.tsximport {Composition, Folder} from 'remotion';import {MyVideo} from './MyVideo';-import {OpeningScene} from './OpeningScene';-import {FeatureScene} from './FeatureScene';+import {Chapter} from './Chapter';export const RemotionRoot = () => (<><Folder name="MyVideo-Scenes"><Composition- id="Opening"- component={OpeningScene}- width={1920}- height={1080}- fps={30}- durationInFrames={90}- />- <Composition- id="Feature"- component={FeatureScene}+ id="Chapter"+ component={Chapter}width={1920}height={1080}fps={30}durationInFrames={120}+ defaultProps={{title: 'Introduction'}}/></Folder><Composition@@ -72,7 +53,7 @@ export const RemotionRoot = () => (```Studio replaces the layers with a reference to the connected composition in the timeline.-Double-clicking a sequence with one connected composition opens it at the corresponding frame.+Double-clicking a timeline item with one connected composition opens it at the corresponding frame.Editing the shared component changes both views.If the scene takes props, pass the intended values in the parent and use matching `defaultProps` on its standalone registration; registration does not automatically copy the parent's props.diff --git a/packages/skills/skills/remotion-markup/multi-scene-video.md b/packages/skills/skills/remotion-markup/multi-scene-video.mdindex 58d194880e..fe8c2fc438 100644--- a/packages/skills/skills/remotion-markup/multi-scene-video.md+++ b/packages/skills/skills/remotion-markup/multi-scene-video.md@@ -4,8 +4,8 @@ Put each substantial scene in its own component and file.Register those components as [connected compositions](connected-compositions.md) so each scene has an editable Studio timeline.Treat the parent timeline as an editable document: Author every scene that-should be edited independently as a separate `<Sequence>`, `<Series.Sequence>`-or `<TransitionSeries.Sequence>` JSX node. Keep its `name` and+should be edited independently as a separate interactive component,+`<Series.Sequence>`, or `<TransitionSeries.Sequence>` JSX node. Keep its `name` and`durationInFrames` inline so the node has its own source-editing target.Programmatic rendering is suitable only when the generated scenes areintentionally controlled as one source template.@@ -85,4 +85,4 @@ Keep each scene's standalone metadata and `defaultProps` consistent with how itWith no transition, this example needs a 210-frame main composition. If you add a transition, account for its overlap in the main duration; see [transitions](transitions.md).-Use `<Series>` for consecutive scenes that do not need transitions. Use `<Sequence>` for scenes placed independently on the parent timeline.+Use `<Series>` for consecutive scenes that do not need transitions. For independently placed scenes, prefer components made with `Interactive.withSchema({wrapInSequence: true})` and put `from` and `durationInFrames` directly on each instance. Avoid an extra `<Sequence>` unless it supplies shared timing, dimension overrides, or timing for a component that does not support it.diff --git a/packages/skills/skills/remotion-markup/sequencing.md b/packages/skills/skills/remotion-markup/sequencing.mdindex 83c7ea03b8..e8ab820e08 100644--- a/packages/skills/skills/remotion-markup/sequencing.md+++ b/packages/skills/skills/remotion-markup/sequencing.md@@ -5,89 +5,34 @@ metadata:tags: sequence, series, timing, delay, trim----Use `<Sequence>` to delay when an element appears in the timeline.+Prefer timing props directly on built-in interactive components and custom+components made with `Interactive.withSchema({wrapInSequence: true})`. Avoid+wrapping a single timing-capable component in a redundant `<Sequence>`.-```tsx-const Main = () => {- return (- <AbsoluteFill>- <Background />- <AbsoluteFill>- <Sequence name="Title" from={30} durationInFrames={60} layout="none">- <Title />- </Sequence>- <Sequence- name="Subtitle"- from={60}- durationInFrames={60}- layout="none"- >- <Subtitle />- </Sequence>- </AbsoluteFill>- </AbsoluteFill>- );-}--export const Title = () => {- const frame = useCurrentFrame();-- return (- <Interactive.Div- name="Label"- style={{- opacity: interpolate(frame, [0, 60], [0, 1], {- extrapolateRight: "clamp",- extrapolateLeft: "clamp",- easing: Easing.bezier(0.16, 1, 0.3, 1),- }),- fontSize: 88- }}- >- Title- </Interactive.Div>- );-};--export const Subtitle = () => {- const frame = useCurrentFrame();-- return (- <Interactive.Div- name="Subtitle"- style={{- opacity: interpolate(frame, [0, 60], [0, 1], {- extrapolateRight: "clamp",- extrapolateLeft: "clamp",- easing: Easing.bezier(0.16, 1, 0.3, 1),- }),- fontSize: 32- }}- >- Subtitle- </Interactive.Div>- );-};-```--This will by default wrap the component in an absolute fill element.-If the items should not be wrapped, use the `layout` prop:+See [Remotion Interactivity](../remotion-interactivity/SKILL.md) for creating+schema-wrapped components and [connected compositions](connected-compositions.md)+for registering them with their own Studio timelines.```tsx-<Sequence layout="none">- <Title />-</Sequence>+// Title and Subtitle are exported with Interactive.withSchema({wrapInSequence: true}).+<AbsoluteFill>+ <Title name="Title" from={30} durationInFrames={60} />+ <Subtitle name="Subtitle" from={60} durationInFrames={60} />+</AbsoluteFill>```+Use an explicit `<Sequence>` when multiple siblings need one shared clock,+when overriding dimensions for descendants, or when the child does not accept+timing props. Its default layout adds an absolutely positioned fill element;+use `layout="none"` when no layout wrapper is needed.+## Premounting-This loads the component in the timeline before it is actually played.-Always premount any `<Sequence>`!+Use `premountFor` when media or expensive content needs preparation before it+becomes visible. Pass it directly to a timing-capable component:```tsx-<Sequence premountFor={1 * fps}>- <Title />-</Sequence>+<Title from={60} durationInFrames={90} premountFor={30} />```## Series@@ -146,12 +91,8 @@ Sequences can be nested for complex timing:```tsx<Sequence from={0} durationInFrames={120}><Background />- <Sequence from={15} durationInFrames={90} layout="none">- <Title />- </Sequence>- <Sequence from={45} durationInFrames={60} layout="none">- <Subtitle />- </Sequence>+ <Title from={15} durationInFrames={90} />+ <Subtitle from={45} durationInFrames={60} /></Sequence>```