Skip to content

🎥 Make videos programmatically with React

remotion: Apply managed layout to scenes and authoring guidance

Jonny Burger8ffb526bf029
diff --git a/.agents/skills/interactivity-best-practices/SKILL.md b/.agents/skills/interactivity-best-practices/SKILL.md
index afdf77c73e..2495e91c4e 100644
--- a/.agents/skills/interactivity-best-practices/SKILL.md
+++ b/.agents/skills/interactivity-best-practices/SKILL.md
@@ -5,7 +5,10 @@ description: Best practices for writing Remotion animations that stay intuitive
# Interactivity Best Practices
-Use the canonical interactivity best-practices page instead:
+For scene structure and custom interactive components, use
+[Remotion Interactivity](../remotion-interactivity/SKILL.md).
+
+For editable styles and animations, use the canonical best-practices page:
[packages/docs/docs/studio/interactivity-best-practices.mdx](../../../packages/docs/docs/studio/interactivity-best-practices.mdx)
To make an element or custom component interactive, use:
diff --git a/packages/brand/src/BasicsLeftTrimComposition.tsx b/packages/brand/src/BasicsLeftTrimComposition.tsx
index 2f427439ed..55e020b68a 100644
--- a/packages/brand/src/BasicsLeftTrimComposition.tsx
+++ b/packages/brand/src/BasicsLeftTrimComposition.tsx
@@ -13,10 +13,8 @@ import {
} from 'remotion';
const BasicsLeftTrimInner = ({
- style,
captureStyle,
}: {
- readonly style: React.CSSProperties | null;
readonly captureStyle: React.CSSProperties | null;
}) => {
const frame = useCurrentFrame();
@@ -475,7 +473,8 @@ const BasicsLeftTrimInner = ({
return (
<AbsoluteFill
- style={{backgroundColor: '#111518', overflow: 'hidden', ...style}}
+ showInTimeline={false}
+ style={{backgroundColor: '#111518', overflow: 'hidden'}}
>
{HtmlInCanvas.isSupported() ? (
<HtmlInCanvas
@@ -531,6 +530,7 @@ export const BasicsLeftTrimPreview = Interactive.withSchema({
componentName: '<BasicsLeftTrimPreview>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsLeftTrimComposition = () => {
@@ -540,7 +540,7 @@ export const BasicsLeftTrimComposition = () => {
component={BasicsLeftTrimPreview}
width={1920}
height={1080}
- defaultProps={{style: null, captureStyle: null}}
+ defaultProps={{captureStyle: null}}
fps={60}
durationInFrames={552}
/>
diff --git a/packages/brand/src/BasicsLeftTrimScene.tsx b/packages/brand/src/BasicsLeftTrimScene.tsx
index 279bf0220f..50e07a257b 100644
--- a/packages/brand/src/BasicsLeftTrimScene.tsx
+++ b/packages/brand/src/BasicsLeftTrimScene.tsx
@@ -1,17 +1,12 @@
-import type React from 'react';
import {AbsoluteFill, Composition, Interactive, useVideoConfig} from 'remotion';
import {BasicsLeftTrimPreview} from './BasicsLeftTrimComposition';
import {BasicsTitlePanel} from './BasicsTitlePanel';
-const BasicsLeftTrimSceneInner = ({
- style,
-}: {
- readonly style: React.CSSProperties | null;
-}) => {
+const BasicsLeftTrimSceneInner = () => {
const {fps, width} = useVideoConfig();
return (
- <AbsoluteFill style={{backgroundColor: '#111518', ...style}}>
+ <AbsoluteFill showInTimeline={false} style={{backgroundColor: '#111518'}}>
<BasicsLeftTrimPreview
trimBefore={4.5 * fps}
durationInFrames={3 * fps}
@@ -31,6 +26,7 @@ export const BasicsLeftTrimScene = Interactive.withSchema({
componentName: '<BasicsLeftTrimScene>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsLeftTrimSceneComposition = () => {
@@ -42,7 +38,6 @@ export const BasicsLeftTrimSceneComposition = () => {
height={1080}
fps={60}
durationInFrames={180}
- defaultProps={{style: null}}
/>
);
};
diff --git a/packages/brand/src/BasicsPlaybackRateComposition.tsx b/packages/brand/src/BasicsPlaybackRateComposition.tsx
index 2bf0239cda..0600a5ff0c 100644
--- a/packages/brand/src/BasicsPlaybackRateComposition.tsx
+++ b/packages/brand/src/BasicsPlaybackRateComposition.tsx
@@ -13,10 +13,8 @@ import {
} from 'remotion';
const BasicsPlaybackRateInner = ({
- style,
captureStyle,
}: {
- readonly style: React.CSSProperties | null;
readonly captureStyle: React.CSSProperties | null;
}) => {
const frame = useCurrentFrame();
@@ -337,7 +335,8 @@ const BasicsPlaybackRateInner = ({
return (
<AbsoluteFill
- style={{backgroundColor: '#111518', overflow: 'hidden', ...style}}
+ showInTimeline={false}
+ style={{backgroundColor: '#111518', overflow: 'hidden'}}
>
{HtmlInCanvas.isSupported() ? (
<HtmlInCanvas
@@ -393,6 +392,7 @@ export const BasicsPlaybackRatePreview = Interactive.withSchema({
componentName: '<BasicsPlaybackRatePreview>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsPlaybackRateComposition = () => {
@@ -402,7 +402,7 @@ export const BasicsPlaybackRateComposition = () => {
component={BasicsPlaybackRatePreview}
width={1920}
height={1080}
- defaultProps={{style: null, captureStyle: null}}
+ defaultProps={{captureStyle: null}}
fps={60}
durationInFrames={368}
/>
diff --git a/packages/brand/src/BasicsPlaybackRateScene.tsx b/packages/brand/src/BasicsPlaybackRateScene.tsx
index 71611b48e4..0988bf21ee 100644
--- a/packages/brand/src/BasicsPlaybackRateScene.tsx
+++ b/packages/brand/src/BasicsPlaybackRateScene.tsx
@@ -1,17 +1,12 @@
-import type React from 'react';
import {AbsoluteFill, Composition, Interactive, useVideoConfig} from 'remotion';
import {BasicsPlaybackRatePreview} from './BasicsPlaybackRateComposition';
import {BasicsTitlePanel} from './BasicsTitlePanel';
-const BasicsPlaybackRateSceneInner = ({
- style,
-}: {
- readonly style: React.CSSProperties | null;
-}) => {
+const BasicsPlaybackRateSceneInner = () => {
const {fps, width} = useVideoConfig();
return (
- <AbsoluteFill style={{backgroundColor: '#111518', ...style}}>
+ <AbsoluteFill showInTimeline={false} style={{backgroundColor: '#111518'}}>
<BasicsPlaybackRatePreview
trimBefore={0.9 * fps}
durationInFrames={4.5 * fps}
@@ -32,6 +27,7 @@ export const BasicsPlaybackRateScene = Interactive.withSchema({
componentName: '<BasicsPlaybackRateScene>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsPlaybackRateSceneComposition = () => {
@@ -43,7 +39,6 @@ export const BasicsPlaybackRateSceneComposition = () => {
height={1080}
fps={60}
durationInFrames={180}
- defaultProps={{style: null}}
/>
);
};
diff --git a/packages/brand/src/BasicsSeriesTrimComposition.tsx b/packages/brand/src/BasicsSeriesTrimComposition.tsx
index 44718a5a18..50f54bd6e0 100644
--- a/packages/brand/src/BasicsSeriesTrimComposition.tsx
+++ b/packages/brand/src/BasicsSeriesTrimComposition.tsx
@@ -13,10 +13,8 @@ import {
} from 'remotion';
const BasicsSeriesTrimInner = ({
- style,
captureStyle,
}: {
- readonly style: React.CSSProperties | null;
readonly captureStyle: React.CSSProperties | null;
}) => {
const frame = useCurrentFrame();
@@ -358,7 +356,8 @@ const BasicsSeriesTrimInner = ({
return (
<AbsoluteFill
- style={{backgroundColor: '#111518', overflow: 'hidden', ...style}}
+ showInTimeline={false}
+ style={{backgroundColor: '#111518', overflow: 'hidden'}}
>
{HtmlInCanvas.isSupported() ? (
<HtmlInCanvas
@@ -414,6 +413,7 @@ export const BasicsSeriesTrimPreview = Interactive.withSchema({
componentName: '<BasicsSeriesTrimPreview>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsSeriesTrimComposition = () => {
@@ -423,7 +423,7 @@ export const BasicsSeriesTrimComposition = () => {
component={BasicsSeriesTrimPreview}
width={1920}
height={1080}
- defaultProps={{style: null, captureStyle: null}}
+ defaultProps={{captureStyle: null}}
fps={60}
durationInFrames={463}
/>
diff --git a/packages/brand/src/BasicsSeriesTrimScene.tsx b/packages/brand/src/BasicsSeriesTrimScene.tsx
index 3e737ac288..fde36da098 100644
--- a/packages/brand/src/BasicsSeriesTrimScene.tsx
+++ b/packages/brand/src/BasicsSeriesTrimScene.tsx
@@ -1,17 +1,12 @@
-import type React from 'react';
import {AbsoluteFill, Composition, Interactive, useVideoConfig} from 'remotion';
import {BasicsSeriesTrimPreview} from './BasicsSeriesTrimComposition';
import {BasicsTitlePanel} from './BasicsTitlePanel';
-const BasicsSeriesTrimSceneInner = ({
- style,
-}: {
- readonly style: React.CSSProperties | null;
-}) => {
+const BasicsSeriesTrimSceneInner = () => {
const {fps, width} = useVideoConfig();
return (
- <AbsoluteFill style={{backgroundColor: '#111518', ...style}}>
+ <AbsoluteFill showInTimeline={false} style={{backgroundColor: '#111518'}}>
<BasicsSeriesTrimPreview
trimBefore={1.95 * fps}
durationInFrames={4.5 * fps}
@@ -32,6 +27,7 @@ export const BasicsSeriesTrimScene = Interactive.withSchema({
componentName: '<BasicsSeriesTrimScene>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsSeriesTrimSceneComposition = () => {
@@ -43,7 +39,6 @@ export const BasicsSeriesTrimSceneComposition = () => {
height={1080}
fps={60}
durationInFrames={180}
- defaultProps={{style: null}}
/>
);
};
diff --git a/packages/brand/src/BasicsShowcase.tsx b/packages/brand/src/BasicsShowcase.tsx
index f9eb0bb225..1b1d4f7e3f 100644
--- a/packages/brand/src/BasicsShowcase.tsx
+++ b/packages/brand/src/BasicsShowcase.tsx
@@ -41,42 +41,42 @@ export const BasicsShowcase = () => {
durationInFrames={3 * fps}
premountFor={fps}
>
- <BasicsLeftTrimScene premountFor={fps} style={null} />
+ <BasicsLeftTrimScene premountFor={fps} />
</Series.Sequence>
<Series.Sequence
name="Source-only trim"
durationInFrames={3 * fps}
premountFor={fps}
>
- <BasicsSourceOnlyTrimScene premountFor={fps} style={null} />
+ <BasicsSourceOnlyTrimScene premountFor={fps} />
</Series.Sequence>
<Series.Sequence
name="Series trimming"
durationInFrames={3 * fps}
premountFor={fps}
>
- <BasicsSeriesTrimScene premountFor={fps} style={null} />
+ <BasicsSeriesTrimScene premountFor={fps} />
</Series.Sequence>
<Series.Sequence
name="Playback rate"
durationInFrames={3 * fps}
premountFor={fps}
>
- <BasicsPlaybackRateScene premountFor={fps} style={null} />
+ <BasicsPlaybackRateScene premountFor={fps} />
</Series.Sequence>
<Series.Sequence
name="Volume keyframes"
durationInFrames={3 * fps}
premountFor={fps}
>
- <BasicsVolumeKeyframesScene premountFor={fps} style={null} />
+ <BasicsVolumeKeyframesScene premountFor={fps} />
</Series.Sequence>
<Series.Sequence
name="Virtualized timeline"
durationInFrames={3 * fps}
premountFor={fps}
>
- <BasicsVirtualizedTimelineScene premountFor={fps} style={null} />
+ <BasicsVirtualizedTimelineScene premountFor={fps} />
</Series.Sequence>
</Series>
);
diff --git a/packages/brand/src/BasicsSourceOnlyTrimComposition.tsx b/packages/brand/src/BasicsSourceOnlyTrimComposition.tsx
index c7303bfca0..a51e09b1e2 100644
--- a/packages/brand/src/BasicsSourceOnlyTrimComposition.tsx
+++ b/packages/brand/src/BasicsSourceOnlyTrimComposition.tsx
@@ -13,10 +13,8 @@ import {
} from 'remotion';
const BasicsSourceOnlyTrimInner = ({
- style,
captureStyle,
}: {
- readonly style: React.CSSProperties | null;
readonly captureStyle: React.CSSProperties | null;
}) => {
const frame = useCurrentFrame();
@@ -317,7 +315,8 @@ const BasicsSourceOnlyTrimInner = ({
return (
<AbsoluteFill
- style={{backgroundColor: '#111518', overflow: 'hidden', ...style}}
+ showInTimeline={false}
+ style={{backgroundColor: '#111518', overflow: 'hidden'}}
>
{HtmlInCanvas.isSupported() ? (
<HtmlInCanvas
@@ -373,6 +372,7 @@ export const BasicsSourceOnlyTrimPreview = Interactive.withSchema({
componentName: '<BasicsSourceOnlyTrimPreview>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsSourceOnlyTrimComposition = () => {
@@ -382,7 +382,7 @@ export const BasicsSourceOnlyTrimComposition = () => {
component={BasicsSourceOnlyTrimPreview}
width={1920}
height={1080}
- defaultProps={{style: null, captureStyle: null}}
+ defaultProps={{captureStyle: null}}
fps={60}
durationInFrames={375}
/>
diff --git a/packages/brand/src/BasicsSourceOnlyTrimScene.tsx b/packages/brand/src/BasicsSourceOnlyTrimScene.tsx
index 4255a63ec7..8d67fde044 100644
--- a/packages/brand/src/BasicsSourceOnlyTrimScene.tsx
+++ b/packages/brand/src/BasicsSourceOnlyTrimScene.tsx
@@ -1,17 +1,12 @@
-import type React from 'react';
import {AbsoluteFill, Composition, Interactive, useVideoConfig} from 'remotion';
import {BasicsSourceOnlyTrimPreview} from './BasicsSourceOnlyTrimComposition';
import {BasicsTitlePanel} from './BasicsTitlePanel';
-const BasicsSourceOnlyTrimSceneInner = ({
- style,
-}: {
- readonly style: React.CSSProperties | null;
-}) => {
+const BasicsSourceOnlyTrimSceneInner = () => {
const {fps, width} = useVideoConfig();
return (
- <AbsoluteFill style={{backgroundColor: '#111518', ...style}}>
+ <AbsoluteFill showInTimeline={false} style={{backgroundColor: '#111518'}}>
<BasicsSourceOnlyTrimPreview
trimBefore={1.5 * fps}
durationInFrames={3 * fps}
@@ -31,6 +26,7 @@ export const BasicsSourceOnlyTrimScene = Interactive.withSchema({
componentName: '<BasicsSourceOnlyTrimScene>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsSourceOnlyTrimSceneComposition = () => {
@@ -42,7 +38,6 @@ export const BasicsSourceOnlyTrimSceneComposition = () => {
height={1080}
fps={60}
durationInFrames={180}
- defaultProps={{style: null}}
/>
);
};
diff --git a/packages/brand/src/BasicsVirtualizedTimelineComposition.tsx b/packages/brand/src/BasicsVirtualizedTimelineComposition.tsx
index ddae389f5d..1084533ceb 100644
--- a/packages/brand/src/BasicsVirtualizedTimelineComposition.tsx
+++ b/packages/brand/src/BasicsVirtualizedTimelineComposition.tsx
@@ -13,10 +13,8 @@ import {
} from 'remotion';
const BasicsVirtualizedTimelineInner = ({
- style,
captureStyle,
}: {
- readonly style: React.CSSProperties | null;
readonly captureStyle: React.CSSProperties | null;
}) => {
const frame = useCurrentFrame();
@@ -505,7 +503,8 @@ const BasicsVirtualizedTimelineInner = ({
return (
<AbsoluteFill
- style={{backgroundColor: '#111518', overflow: 'hidden', ...style}}
+ showInTimeline={false}
+ style={{backgroundColor: '#111518', overflow: 'hidden'}}
>
{HtmlInCanvas.isSupported() ? (
<HtmlInCanvas
@@ -561,6 +560,7 @@ export const BasicsVirtualizedTimelinePreview = Interactive.withSchema({
componentName: '<BasicsVirtualizedTimelinePreview>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsVirtualizedTimelineComposition = () => {
@@ -570,7 +570,7 @@ export const BasicsVirtualizedTimelineComposition = () => {
component={BasicsVirtualizedTimelinePreview}
width={1920}
height={1080}
- defaultProps={{style: null, captureStyle: null}}
+ defaultProps={{captureStyle: null}}
fps={60}
durationInFrames={1189}
/>
diff --git a/packages/brand/src/BasicsVirtualizedTimelineScene.tsx b/packages/brand/src/BasicsVirtualizedTimelineScene.tsx
index 258f29a0e4..1eed7636aa 100644
--- a/packages/brand/src/BasicsVirtualizedTimelineScene.tsx
+++ b/packages/brand/src/BasicsVirtualizedTimelineScene.tsx
@@ -1,17 +1,12 @@
-import type React from 'react';
import {AbsoluteFill, Composition, Interactive, useVideoConfig} from 'remotion';
import {BasicsTitlePanel} from './BasicsTitlePanel';
import {BasicsVirtualizedTimelinePreview} from './BasicsVirtualizedTimelineComposition';
-const BasicsVirtualizedTimelineSceneInner = ({
- style,
-}: {
- readonly style: React.CSSProperties | null;
-}) => {
+const BasicsVirtualizedTimelineSceneInner = () => {
const {fps, width} = useVideoConfig();
return (
- <AbsoluteFill style={{backgroundColor: '#111518', ...style}}>
+ <AbsoluteFill showInTimeline={false} style={{backgroundColor: '#111518'}}>
<BasicsVirtualizedTimelinePreview
trimBefore={4.5 * fps}
durationInFrames={3 * fps}
@@ -31,6 +26,7 @@ export const BasicsVirtualizedTimelineScene = Interactive.withSchema({
componentName: '<BasicsVirtualizedTimelineScene>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsVirtualizedTimelineSceneComposition = () => {
@@ -42,7 +38,6 @@ export const BasicsVirtualizedTimelineSceneComposition = () => {
height={1080}
fps={60}
durationInFrames={180}
- defaultProps={{style: null}}
/>
);
};
diff --git a/packages/brand/src/BasicsVolumeKeyframesComposition.tsx b/packages/brand/src/BasicsVolumeKeyframesComposition.tsx
index 1f3da50e04..72aee659a9 100644
--- a/packages/brand/src/BasicsVolumeKeyframesComposition.tsx
+++ b/packages/brand/src/BasicsVolumeKeyframesComposition.tsx
@@ -13,10 +13,8 @@ import {
} from 'remotion';
const BasicsVolumeKeyframesInner = ({
- style,
captureStyle,
}: {
- readonly style: React.CSSProperties | null;
readonly captureStyle: React.CSSProperties | null;
}) => {
const frame = useCurrentFrame();
@@ -1272,7 +1270,8 @@ const BasicsVolumeKeyframesInner = ({
return (
<AbsoluteFill
- style={{backgroundColor: '#111518', overflow: 'hidden', ...style}}
+ showInTimeline={false}
+ style={{backgroundColor: '#111518', overflow: 'hidden'}}
>
{HtmlInCanvas.isSupported() ? (
<HtmlInCanvas
@@ -1328,6 +1327,7 @@ export const BasicsVolumeKeyframesPreview = Interactive.withSchema({
componentName: '<BasicsVolumeKeyframesPreview>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsVolumeKeyframesComposition = () => {
@@ -1337,7 +1337,7 @@ export const BasicsVolumeKeyframesComposition = () => {
component={BasicsVolumeKeyframesPreview}
width={1920}
height={1080}
- defaultProps={{style: null, captureStyle: null}}
+ defaultProps={{captureStyle: null}}
fps={60}
durationInFrames={1785}
/>
diff --git a/packages/brand/src/BasicsVolumeKeyframesScene.tsx b/packages/brand/src/BasicsVolumeKeyframesScene.tsx
index c7e1b402db..9fd38f3dff 100644
--- a/packages/brand/src/BasicsVolumeKeyframesScene.tsx
+++ b/packages/brand/src/BasicsVolumeKeyframesScene.tsx
@@ -1,17 +1,12 @@
-import type React from 'react';
import {AbsoluteFill, Composition, Interactive, useVideoConfig} from 'remotion';
import {BasicsTitlePanel} from './BasicsTitlePanel';
import {BasicsVolumeKeyframesPreview} from './BasicsVolumeKeyframesComposition';
-const BasicsVolumeKeyframesSceneInner = ({
- style,
-}: {
- readonly style: React.CSSProperties | null;
-}) => {
+const BasicsVolumeKeyframesSceneInner = () => {
const {fps, width} = useVideoConfig();
return (
- <AbsoluteFill style={{backgroundColor: '#111518', ...style}}>
+ <AbsoluteFill showInTimeline={false} style={{backgroundColor: '#111518'}}>
<BasicsVolumeKeyframesPreview
trimBefore={25.05 * fps}
durationInFrames={3 * fps}
@@ -31,6 +26,7 @@ export const BasicsVolumeKeyframesScene = Interactive.withSchema({
componentName: '<BasicsVolumeKeyframesScene>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
export const BasicsVolumeKeyframesSceneComposition = () => {
@@ -42,7 +38,6 @@ export const BasicsVolumeKeyframesSceneComposition = () => {
height={1080}
fps={60}
durationInFrames={180}
- defaultProps={{style: null}}
/>
);
};
diff --git a/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx b/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx
index 64c7fa191a..d2922ccf23 100644
--- a/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx
+++ b/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx
@@ -17,7 +17,6 @@ import {CodeTransition} from './CodeTransition';
const THEME = 'github-light';
type CodeBRollProps = {
- readonly style?: React.CSSProperties;
readonly code: string;
/** Previous code for transition animation. Default: none */
readonly previousCode?: string;
@@ -32,7 +31,6 @@ const CodeBRollInner: React.FC<CodeBRollProps> = ({
previousCode,
lang = 'tsx',
topExplainer = '',
- style,
}) => {
const frame = useCurrentFrame();
const {fps} = useVideoConfig();
@@ -69,17 +67,20 @@ const CodeBRollInner: React.FC<CodeBRollProps> = ({
return (
<AbsoluteFill
+ showInTimeline={false}
name="Code example fade"
style={{
opacity: interpolate(frame, [0, 6, 114, 120], [0, 1, 1, 0], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
}),
- ...style,
}}
>
<ThemeProvider themeColors={data.themeColors}>
- <AbsoluteFill style={{backgroundColor: data.themeColors.background}}>
+ <AbsoluteFill
+ showInTimeline={false}
+ style={{backgroundColor: data.themeColors.background}}
+ >
{data.previousHighlighted &&
transitionDelay > 0 &&
frame < transitionDelay && (
@@ -120,4 +121,5 @@ export const CodeBRoll = Interactive.withSchema({
componentName: '<CodeBRoll>',
schema: codeBRollSchema,
wrapInSequence: true,
+ layout: 'absolute-fill',
});
diff --git a/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx b/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx
index a71b269a2a..d6d2384938 100644
--- a/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx
+++ b/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx
@@ -32,7 +32,6 @@ const loadFont = async () => {
loadFont();
type NumberedChapterProps = {
- readonly style?: React.CSSProperties;
chapterNumber: number;
chapterTitle: string;
};
@@ -40,17 +39,16 @@ type NumberedChapterProps = {
const NumberedChapterInner: React.FC<NumberedChapterProps> = ({
chapterNumber,
chapterTitle,
- style,
}) => {
const frame = useCurrentFrame();
return (
<AbsoluteFill
+ showInTimeline={false}
style={{
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
- ...style,
}}
>
<Audio
@@ -147,4 +145,5 @@ export const NumberedChapter = Interactive.withSchema({
componentName: '<NumberedChapter>',
schema: numberedChapterSchema,
wrapInSequence: true,
+ layout: 'absolute-fill',
});
diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx
index 8e191cda6b..3dad193fb1 100644
--- a/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx
+++ b/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx
@@ -22,7 +22,6 @@ const LINE_HEIGHT = 54;
const POSTERIZE_FRAMES = 3;
export type PromptProps = {
- readonly style?: React.CSSProperties;
prompt: string;
thinkingIndex: number;
};
@@ -50,7 +49,7 @@ const Cursor: React.FC<{frame: number}> = ({frame}) => {
);
};
-const PromptInner: React.FC<PromptProps> = ({prompt, thinkingIndex, style}) => {
+const PromptInner: React.FC<PromptProps> = ({prompt, thinkingIndex}) => {
const frame = useCurrentFrame();
const {fps} = useVideoConfig();
const typingAnimationFrame =
@@ -75,11 +74,11 @@ const PromptInner: React.FC<PromptProps> = ({prompt, thinkingIndex, style}) => {
return (
<AbsoluteFill
+ showInTimeline={false}
style={{
justifyContent: 'flex-end',
alignItems: 'center',
paddingBottom: 80,
- ...style,
}}
>
<Audio
@@ -165,4 +164,5 @@ export const Prompt = Interactive.withSchema({
componentName: '<Prompt>',
schema: promptSchema,
wrapInSequence: true,
+ layout: 'absolute-fill',
});
diff --git a/packages/docs/docs/interactive-with-schema.mdx b/packages/docs/docs/interactive-with-schema.mdx
index 0e28ae844f..1cfe3c9a94 100644
--- a/packages/docs/docs/interactive-with-schema.mdx
+++ b/packages/docs/docs/interactive-with-schema.mdx
@@ -99,14 +99,30 @@ Set to `'absolute-fill'` to give the component a full-size, absolutely positione
The inner component can return a fragment and does not need to forward styles:
```tsx twoslash title="Scene.tsx"
-import type React from 'react';
-import {Interactive} from 'remotion';
+import React from 'react';
+import {Video} from '@remotion/media';
+import {Interactive, useVideoConfig} from 'remotion';
-const SceneInner: React.FC = () => (
- <>
- <div>Scene content</div>
- </>
-);
+const SceneInner: React.FC = () => {
+ const {fps} = useVideoConfig();
+
+ return (
+ <>
+ <Video
+ src="https://remotion.media/jonnys-videos/roller-skis-new/footage/IMG_0466.mp4"
+ premountFor={fps}
+ objectFit="cover"
+ style={{width: '100%', height: '100%'}}
+ />
+ <Interactive.Div
+ name="Title"
+ style={{position: 'absolute', left: 80, bottom: 80, color: 'white', fontSize: 80}}
+ >
+ Under the trees
+ </Interactive.Div>
+ </>
+ );
+};
export const Scene = Interactive.withSchema({
Component: SceneInner,
@@ -116,7 +132,9 @@ export const Scene = Interactive.withSchema({
layout: 'absolute-fill',
});
-const Example = () => <Scene style={{backgroundColor: 'black', opacity: 0.5}} />;
+const Example = () => (
+ <Scene from={30} durationInFrames={90} premountFor={30} style={{opacity: 0.5}} />
+);
```
Keep `'none'` when styles need to apply directly to an element with its own size or layout, such as a text box, SVG, or button.
diff --git a/packages/docs/docs/interactive.mdx b/packages/docs/docs/interactive.mdx
index 11f2f62491..8e77d987d8 100644
--- a/packages/docs/docs/interactive.mdx
+++ b/packages/docs/docs/interactive.mdx
@@ -91,7 +91,7 @@ Controls for cropping an element from each edge:
[`cropLeft`](/docs/sequence#cropleft), [`cropRight`](/docs/sequence#cropright), [`cropTop`](/docs/sequence#croptop) and [`cropBottom`](/docs/sequence#cropbottom).
-[`Interactive.withSchema()`](/docs/interactive-with-schema) includes this schema and applies the crop through the component's `style` prop.
+[`Interactive.withSchema()`](/docs/interactive-with-schema) includes this schema. With [`layout: 'absolute-fill'`](/docs/interactive-with-schema#layout), the crop applies to its container; with the default layout, it applies through the component's `style` prop.
### `Interactive.textSchema`<AvailableFrom v="4.0.481" />
diff --git a/packages/docs/docs/miscellaneous/snippets/freeze-portions.mdx b/packages/docs/docs/miscellaneous/snippets/freeze-portions.mdx
index e02a1465da..d08d25693d 100644
--- a/packages/docs/docs/miscellaneous/snippets/freeze-portions.mdx
+++ b/packages/docs/docs/miscellaneous/snippets/freeze-portions.mdx
@@ -7,11 +7,11 @@ crumb: 'Snippets'
With the following snippet, two portions of a sequence are frozen and resumed afterwards from the point they were paused.
-```tsx twoslash
+```tsx twoslash title="FreezePortion.tsx"
import React, {useMemo} from 'react';
import {Interactive, useCurrentFrame, useVideoConfig} from 'remotion';
-const CounterInner: React.FC<{style?: React.CSSProperties}> = ({style}) => {
+const CounterInner: React.FC = () => {
return (
<div
style={{
@@ -21,7 +21,6 @@ const CounterInner: React.FC<{style?: React.CSSProperties}> = ({style}) => {
fontSize: 60,
height: '100%',
justifyContent: 'center',
- ...style,
}}
>
{useCurrentFrame()}
@@ -34,6 +33,7 @@ export const Counter = Interactive.withSchema({
componentName: '<Counter>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
const FREEZES = [
diff --git a/packages/docs/docs/studio/make-component-interactive.mdx b/packages/docs/docs/studio/make-component-interactive.mdx
index afba2ae995..b361c32792 100644
--- a/packages/docs/docs/studio/make-component-interactive.mdx
+++ b/packages/docs/docs/studio/make-component-interactive.mdx
@@ -12,8 +12,9 @@ To make your component interactive too, wrap it with [`Interactive.withSchema()`
## Create the component
-Create any component. Make sure it accepts `style` and passes it on to its visual root.<br />
-Styles for transforming, premounting, and cropping will be injected.
+For a scene that fills its parent, use [`layout: 'absolute-fill'`](/docs/interactive-with-schema#layout) when wrapping it with `Interactive.withSchema()`. Its inner component can return a fragment; the wrapper handles styles, transforms, premounting, and cropping.
+
+A component with its own size, like the badge below, keeps the default layout and forwards `style` to its visual root.
```tsx twoslash title="Badge.tsx"
import type React from 'react';
diff --git a/packages/example/src/CaptionsTester/AnimatedCaptions.tsx b/packages/example/src/CaptionsTester/AnimatedCaptions.tsx
index 98f5ffd376..c7399c1764 100644
--- a/packages/example/src/CaptionsTester/AnimatedCaptions.tsx
+++ b/packages/example/src/CaptionsTester/AnimatedCaptions.tsx
@@ -5,13 +5,8 @@ import {
AbsoluteFill,
Interactive,
interpolate,
- Sequence,
spring,
- type InteractiveBaseProps,
- type InteractiveTransformProps,
type InteractivitySchema,
- type SequenceControls,
- type SequenceProps,
useCurrentFrame,
useVideoConfig,
} from 'remotion';
@@ -23,7 +18,6 @@ const SWITCH_CAPTIONS_EVERY_MS = 1100;
const HIGHLIGHT_COLOR = '#6cf6ff';
const animatedCaptionsSchema = {
- ...Interactive.baseSchema,
...Interactive.captionsSchema,
width: {
type: 'number',
@@ -41,10 +35,9 @@ const animatedCaptionsSchema = {
description: 'Caption area height',
hiddenFromList: false,
},
- ...Interactive.transformSchema,
} as const satisfies InteractivitySchema;
-const CaptionPage: React.FC<{page: TikTokPage}> = ({page}) => {
+const CaptionPageInner: React.FC<{page: TikTokPage}> = ({page}) => {
const frame = useCurrentFrame();
const {fps} = useVideoConfig();
const absoluteTimeMs = page.startMs + (frame / fps) * 1000;
@@ -65,6 +58,7 @@ const CaptionPage: React.FC<{page: TikTokPage}> = ({page}) => {
return (
<AbsoluteFill
+ showInTimeline={false}
style={{
alignItems: 'center',
justifyContent: 'center',
@@ -113,15 +107,19 @@ const CaptionPage: React.FC<{page: TikTokPage}> = ({page}) => {
);
};
-type AnimatedCaptionsProps = InteractiveBaseProps &
- InteractiveTransformProps &
- Pick<SequenceProps, 'width' | 'height'> & {
- readonly captions: Caption[];
- };
+const CaptionPage = Interactive.withSchema({
+ Component: CaptionPageInner,
+ componentName: '<CaptionPage>',
+ schema: {},
+ wrapInSequence: true,
+ layout: 'absolute-fill',
+});
+
+type AnimatedCaptionsProps = {
+ readonly captions: Caption[];
+};
-const AnimatedCaptionsInner: React.FC<
- AnimatedCaptionsProps & {readonly controls: SequenceControls | undefined}
-> = ({captions, controls, name, style, ...sequenceProps}) => {
+const AnimatedCaptionsInner: React.FC<AnimatedCaptionsProps> = ({captions}) => {
const {fps} = useVideoConfig();
const pages = useMemo(() => {
return createTikTokStyleCaptions({
@@ -131,12 +129,7 @@ const AnimatedCaptionsInner: React.FC<
}, [captions]);
return (
- <Sequence
- {...sequenceProps}
- name={name ?? '<AnimatedCaptions>'}
- style={style}
- controls={controls}
- >
+ <>
{pages.map((page, index) => {
const nextPage = pages[index + 1];
const startFrame = Math.round((page.startMs / 1000) * fps);
@@ -152,18 +145,17 @@ const AnimatedCaptionsInner: React.FC<
const durationInFrames = Math.max(1, endFrame - startFrame);
return (
- <Sequence
+ <CaptionPage
key={`${page.startMs}-${index}`}
from={startFrame}
durationInFrames={durationInFrames}
premountFor={fps}
showInTimeline={false}
- >
- <CaptionPage page={page} />
- </Sequence>
+ page={page}
+ />
);
})}
- </Sequence>
+ </>
);
};
@@ -171,5 +163,6 @@ export const AnimatedCaptions = Interactive.withSchema({
Component: AnimatedCaptionsInner,
componentName: '<AnimatedCaptions>',
schema: animatedCaptionsSchema,
- supportsEffects: false,
+ wrapInSequence: true,
+ layout: 'absolute-fill',
});
diff --git a/packages/example/src/RoughNotation/paper-texture.element.tsx b/packages/example/src/RoughNotation/paper-texture.element.tsx
index 0ede68078e..4ccea58a4c 100644
--- a/packages/example/src/RoughNotation/paper-texture.element.tsx
+++ b/packages/example/src/RoughNotation/paper-texture.element.tsx
@@ -1,36 +1,27 @@
import {paper} from '@remotion/effects/paper';
import React from 'react';
-import {
- AbsoluteFill,
- Interactive,
- interpolate,
- Solid,
- useCurrentFrame,
- type InteractiveTransformProps,
-} from 'remotion';
+import {Interactive, interpolate, Solid, useCurrentFrame} from 'remotion';
-const PaperTextureInner: React.FC<InteractiveTransformProps> = ({style}) => {
+const PaperTextureInner: React.FC = () => {
const frame = useCurrentFrame();
return (
- <AbsoluteFill style={style} showInTimeline={false}>
- <Solid
- color="white"
- width={1920}
- height={1080}
- effects={[
- paper({
- colorFront: 'white',
- colorBack: 'white',
- seed: interpolate(frame, [0, 120], [0, 1000], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- posterize: 30,
- }),
+ <Solid
+ color="white"
+ width={1920}
+ height={1080}
+ effects={[
+ paper({
+ colorFront: 'white',
+ colorBack: 'white',
+ seed: interpolate(frame, [0, 120], [0, 1000], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ posterize: 30,
}),
- ]}
- />
- </AbsoluteFill>
+ }),
+ ]}
+ />
);
};
@@ -39,4 +30,5 @@ export const PaperTexture = Interactive.withSchema({
componentName: '<PaperTexture>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
diff --git a/packages/example/src/paper-texture.element.tsx b/packages/example/src/paper-texture.element.tsx
index 5c72f47686..70f137f506 100644
--- a/packages/example/src/paper-texture.element.tsx
+++ b/packages/example/src/paper-texture.element.tsx
@@ -1,38 +1,34 @@
import {paper} from '@remotion/effects/paper';
import React from 'react';
import {
- AbsoluteFill,
Interactive,
interpolate,
Solid,
useCurrentFrame,
useVideoConfig,
- type InteractiveTransformProps,
} from 'remotion';
-const PaperTextureInner: React.FC<InteractiveTransformProps> = ({style}) => {
+const PaperTextureInner: React.FC = () => {
const frame = useCurrentFrame();
const {height, width} = useVideoConfig();
return (
- <AbsoluteFill style={style} showInTimeline={false}>
- <Solid
- color="white"
- width={width}
- height={height}
- effects={[
- paper({
- colorFront: 'white',
- colorBack: 'white',
- seed: interpolate(frame, [0, 120], [0, 1000], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- posterize: 30,
- }),
+ <Solid
+ color="white"
+ width={width}
+ height={height}
+ effects={[
+ paper({
+ colorFront: 'white',
+ colorBack: 'white',
+ seed: interpolate(frame, [0, 120], [0, 1000], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ posterize: 30,
}),
- ]}
- />
- </AbsoluteFill>
+ }),
+ ]}
+ />
);
};
@@ -41,4 +37,5 @@ export const PaperTexture = Interactive.withSchema({
componentName: '<PaperTexture>',
schema: {},
wrapInSequence: true,
+ layout: 'absolute-fill',
});
diff --git a/packages/jonnys-videos/src/components/AnimatedCaptions.tsx b/packages/jonnys-videos/src/components/AnimatedCaptions.tsx
index 15c74bf586..e14ec66aae 100644
--- a/packages/jonnys-videos/src/components/AnimatedCaptions.tsx
+++ b/packages/jonnys-videos/src/components/AnimatedCaptions.tsx
@@ -372,38 +372,36 @@ const AnimatedCaptionsContent: React.FC<{
}),
]}
>
- <AbsoluteFill showInTimeline={false}>
- {pages.map((page, index) => {
- const pageKey = `${page.startMs}-${index}`;
- const nextPage = pages[index + 1];
- const startFrame = Math.round((page.startMs / 1000) * fps);
- const naturalEndFrame = Math.ceil(
- ((page.startMs + page.durationMs) / 1000) * fps,
- );
- const endFrame = nextPage
- ? Math.min(
- Math.round((nextPage.startMs / 1000) * fps),
- naturalEndFrame,
- )
- : naturalEndFrame;
- const durationInFrames = Math.max(1, endFrame - startFrame);
+ {pages.map((page, index) => {
+ const pageKey = `${page.startMs}-${index}`;
+ const nextPage = pages[index + 1];
+ const startFrame = Math.round((page.startMs / 1000) * fps);
+ const naturalEndFrame = Math.ceil(
+ ((page.startMs + page.durationMs) / 1000) * fps,
+ );
+ const endFrame = nextPage
+ ? Math.min(
+ Math.round((nextPage.startMs / 1000) * fps),
+ naturalEndFrame,
+ )
+ : naturalEndFrame;
+ const durationInFrames = Math.max(1, endFrame - startFrame);
- return (
- <CaptionPage
- key={pageKey}
- from={startFrame}
- durationInFrames={durationInFrames}
- premountFor={fps}
- showInTimeline={false}
- focusProgress={focusProgress}
- focusedTokenIndex={focusedTokenIndex}
- page={page}
- pageKey={pageKey}
- onWordFocusRegions={onWordFocusRegions}
- />
- );
- })}
- </AbsoluteFill>
+ return (
+ <CaptionPage
+ key={pageKey}
+ from={startFrame}
+ durationInFrames={durationInFrames}
+ premountFor={fps}
+ showInTimeline={false}
+ focusProgress={focusProgress}
+ focusedTokenIndex={focusedTokenIndex}
+ page={page}
+ pageKey={pageKey}
+ onWordFocusRegions={onWordFocusRegions}
+ />
+ );
+ })}
</HtmlInCanvas>
</>
);
diff --git a/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx b/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx
index cf9da024f8..d6e4139312 100644
--- a/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx
+++ b/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx
@@ -163,7 +163,7 @@ const AnimatedCaptionsBigWordsInner: React.FC = () => {
}
return (
- <AbsoluteFill showInTimeline={false} premountFor={fps}>
+ <>
<Audio
premountFor={fps}
src={asset(VOICEOVER_FILE)}
@@ -196,7 +196,7 @@ const AnimatedCaptionsBigWordsInner: React.FC = () => {
/>
);
})}
- </AbsoluteFill>
+ </>
);
};
diff --git a/packages/jonnys-videos/src/disco-light-show/Countdown.tsx b/packages/jonnys-videos/src/disco-light-show/Countdown.tsx
index ed801590da..083aec9450 100644
--- a/packages/jonnys-videos/src/disco-light-show/Countdown.tsx
+++ b/packages/jonnys-videos/src/disco-light-show/Countdown.tsx
@@ -83,7 +83,7 @@ const CountdownPage = Interactive.withSchema({
const CountdownInner: React.FC = () => {
const {fps} = useVideoConfig();
return (
- <AbsoluteFill showInTimeline={false} premountFor={fps}>
+ <>
<CountdownPage
name="Countdown 3"
number="3"
@@ -104,7 +104,7 @@ const CountdownInner: React.FC = () => {
durationInFrames={19}
premountFor={fps}
/>
- </AbsoluteFill>
+ </>
);
};
diff --git a/packages/jonnys-videos/src/disco-light-show/DragIn.tsx b/packages/jonnys-videos/src/disco-light-show/DragIn.tsx
index c3f78cc7f2..aee9c7342e 100644
--- a/packages/jonnys-videos/src/disco-light-show/DragIn.tsx
+++ b/packages/jonnys-videos/src/disco-light-show/DragIn.tsx
@@ -1,6 +1,6 @@
import {Video} from '@remotion/media';
import React from 'react';
-import {AbsoluteFill, Interactive} from 'remotion';
+import {Interactive} from 'remotion';
import {asset} from './assets';
const DragInInner: React.FC = () => {
@@ -14,9 +14,11 @@ const DragInInner: React.FC = () => {
height: 1080,
}}
/>
- <AbsoluteFill showInTimeline={false}>
- <Interactive.Div>FOLLOW ME</Interactive.Div>
- </AbsoluteFill>
+ <Interactive.Div
+ style={{position: 'absolute', top: 0, left: 0, right: 0}}
+ >
+ FOLLOW ME
+ </Interactive.Div>
<Video
src={asset('text-behind-video-foreground.webm')}
style={{
diff --git a/packages/jonnys-videos/src/disco-light-show/ScreenRecordingComposition.tsx b/packages/jonnys-videos/src/disco-light-show/ScreenRecordingComposition.tsx
index b6924208cd..98fccbc5e4 100644
--- a/packages/jonnys-videos/src/disco-light-show/ScreenRecordingComposition.tsx
+++ b/packages/jonnys-videos/src/disco-light-show/ScreenRecordingComposition.tsx
@@ -4,7 +4,6 @@ import {rings} from '@remotion/effects/rings';
import {wave} from '@remotion/effects/wave';
import {
Interactive,
- AbsoluteFill,
interpolate,
Solid,
useCurrentFrame,
@@ -18,56 +17,54 @@ const ScreenRecordingCompositionInner: React.FC = () => {
const {fps, durationInFrames} = useVideoConfig();
return (
- <AbsoluteFill showInTimeline={false} premountFor={fps}>
- <Solid
- premountFor={fps}
- width={1080}
- height={1920}
- color={'#191919'}
- style={{
- position: 'absolute',
- }}
- effects={[
- rings({
- colors: ['#000000', '#0b0b0b'],
- center: interpolate(
- frame,
- [0, 279],
- [
- [0, 1],
- [1, 0],
- ],
- {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- },
- ),
- thickness: interpolate(
- frame,
- [0, durationInFrames - 1],
- [84.1, 146.3],
- {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- },
- ),
- gap: 24.8,
- }),
- wave({
- phase: interpolate(frame, [0, durationInFrames - 1], [200, 229], {
+ <Solid
+ premountFor={fps}
+ width={1080}
+ height={1920}
+ color={'#191919'}
+ style={{
+ position: 'absolute',
+ }}
+ effects={[
+ rings({
+ colors: ['#000000', '#0b0b0b'],
+ center: interpolate(
+ frame,
+ [0, 279],
+ [
+ [0, 1],
+ [1, 0],
+ ],
+ {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
- }),
- }),
- blur({
- radius: 20,
- }),
- noise({
- amount: 0.25,
+ },
+ ),
+ thickness: interpolate(
+ frame,
+ [0, durationInFrames - 1],
+ [84.1, 146.3],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ ),
+ gap: 24.8,
+ }),
+ wave({
+ phase: interpolate(frame, [0, durationInFrames - 1], [200, 229], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
}),
- ]}
- />
- </AbsoluteFill>
+ }),
+ blur({
+ radius: 20,
+ }),
+ noise({
+ amount: 0.25,
+ }),
+ ]}
+ />
);
};
diff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.md
index ba2a36e57b..691598cd74 100644
--- a/packages/skills/skills/remotion-interactivity/SKILL.md
+++ b/packages/skills/skills/remotion-interactivity/SKILL.md
@@ -15,77 +15,61 @@ If the markup is too complex for the Studio to make it interactive, then the val
## 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.
+Use `Interactive.withSchema({wrapInSequence: true, layout: 'absolute-fill'})` for scenes whose layers share the canvas. The wrapper provides their visual root and timeline item, so the inner component can return a fragment. Put timing, premounting, dimensions, and per-instance styles on the exported 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.
+Keep decorative implementation details inside the component. An inner layout container can still provide alignment, clipping, or an animated group; a container that only fills the scene is usually unnecessary. Cards, text boxes, and SVGs with their own bounds can keep the default `layout: 'none'` and forward `style` to their visual root.
-```tsx title="LowerThird.tsx"
+```tsx title="Scene.tsx"
+import {Video} from '@remotion/media';
import type React from 'react';
-import {Interactive, type InteractivitySchema} from 'remotion';
+import {Interactive, useVideoConfig, type InteractivitySchema} from 'remotion';
-type LowerThirdProps = {
- readonly children: React.ReactNode;
- readonly accentColor: string;
- readonly style?: React.CSSProperties;
+type SceneProps = {
+ readonly title: string;
};
-const LowerThirdInner: React.FC<LowerThirdProps> = ({
- children,
- accentColor,
- style,
-}) => {
+const SceneInner: React.FC<SceneProps> = ({title}) => {
+ const {fps} = useVideoConfig();
+
return (
- <Interactive.Div
- style={{
- position: 'absolute',
- left: 80,
- bottom: 80,
- display: 'flex',
- alignItems: 'center',
- gap: 20,
- backgroundColor: 'white',
- borderRadius: 16,
- padding: '20px 32px',
- color: 'black',
- fontFamily: 'Helvetica, Arial, sans-serif',
- fontSize: 48,
- fontWeight: 600,
- ...style,
- }}
- >
- <div
+ <>
+ <Video
+ name="Background footage"
+ src="https://remotion.media/video.mp4"
+ premountFor={fps}
+ objectFit="cover"
+ style={{width: '100%', height: '100%'}}
+ />
+ <Interactive.Div
+ name="Scene title"
style={{
- width: 8,
- alignSelf: 'stretch',
- borderRadius: 4,
- backgroundColor: accentColor,
+ position: 'absolute',
+ left: 80,
+ bottom: 80,
+ color: 'white',
+ fontFamily: 'Helvetica, Arial, sans-serif',
+ fontSize: 80,
}}
- />
- {children}
- </Interactive.Div>
+ >
+ {title}
+ </Interactive.Div>
+ </>
);
};
-const lowerThirdSchema = {
- ...Interactive.childrenSchema,
- accentColor: {
- type: 'color',
- default: '#0b84f3',
- description: 'Accent color',
- },
+const sceneSchema = {
+ title: {type: 'string', default: '', description: 'Title'},
} as const satisfies InteractivitySchema;
-export const LowerThird = Interactive.withSchema({
- Component: LowerThirdInner,
- componentName: '<LowerThird>',
- schema: lowerThirdSchema,
+export const Scene = Interactive.withSchema({
+ Component: SceneInner,
+ componentName: '<Scene>',
+ schema: sceneSchema,
wrapInSequence: true,
+ layout: 'absolute-fill',
});
```
-Forwarding the injected `style` inside the component is required; keep editable
-styles inline at the component's call site.
-
### Choose schema fields
Each key in the schema is a prop that Studio can read and edit at the call site.
@@ -148,24 +132,23 @@ its parent. See
[parent independence](../remotion-markup/connected-compositions.md#make-the-component-independent-of-its-parent).
Register the same exported component reference that the parent renders. For the
-example above, use `component={LowerThird}`, not `LowerThirdInner` or an inline wrapper.
+example above, use `component={Scene}`, not `SceneInner` or an inline wrapper.
With `wrapInSequence: true`, no extra `<Sequence>` is needed for the connection.
```tsx title="src/Root.tsx"
import {Composition} from 'remotion';
-import {LowerThird} from './LowerThird';
+import {Scene} from './Scene';
export const RemotionRoot = () => (
<Composition
- id="LowerThird"
- component={LowerThird}
+ id="Scene"
+ component={Scene}
width={1280}
height={720}
fps={30}
durationInFrames={30}
defaultProps={{
- children: 'Jane Doe, Product Designer',
- accentColor: '#0b84f3',
+ title: 'A new perspective',
}}
/>
);
@@ -185,14 +168,14 @@ props. Built-in interactive components and custom components made with
`trimBefore`, `playbackRate`, and `premountFor` directly.
```tsx
-<LowerThird
- name="Lower third"
+<Scene
+ name="Opening scene"
from={30}
durationInFrames={90}
- accentColor="#0b84f3"
->
- Jane Doe, Product Designer
-</LowerThird>
+ premountFor={fps}
+ style={{opacity: 0.9}}
+ title="A new perspective"
+/>
```
When removing a redundant sequence, move its timing and name to the child.
@@ -202,8 +185,9 @@ 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 `<TransitionSeries.Sequence>` for consecutive layout,
+wraps a component that does not handle timing, or supplies dimensions the child
+cannot accept directly. Managed roots also accept `width` and `height` for
+`useVideoConfig()`. Keep `<TransitionSeries.Sequence>` for consecutive layout,
with or without transitions; direct `from` props do not replace those behaviors.
## Give every independently editable item its own JSX node
diff --git a/packages/skills/skills/remotion-markup/SKILL.md b/packages/skills/skills/remotion-markup/SKILL.md
index b0711274ff..4478fb2971 100644
--- a/packages/skills/skills/remotion-markup/SKILL.md
+++ b/packages/skills/skills/remotion-markup/SKILL.md
@@ -28,8 +28,11 @@ 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).
-Prefer `Interactive.withSchema({wrapInSequence: true})` for custom visual components
-with editable props, and register reusable scenes as connected compositions.
+Prefer `Interactive.withSchema({wrapInSequence: true, layout: 'absolute-fill'})`
+for scenes with editable props. Their inner markup can return a fragment; the
+wrapper handles layout and instance styles. Sized elements such as lower thirds
+can keep the default layout and forward `style` to their own root. Register
+reusable scenes as connected compositions.
Put timing directly on components that support it; avoid redundant `<Sequence>` wrappers.
Give every timed component that supports `premountFor` one second of premounting:
`premountFor={fps}`, where `fps` comes from `useVideoConfig()`. Apply this to
diff --git a/packages/skills/skills/remotion-markup/connected-compositions.md b/packages/skills/skills/remotion-markup/connected-compositions.md
index 16a74bd34a..6b5c86340b 100644
--- a/packages/skills/skills/remotion-markup/connected-compositions.md
+++ b/packages/skills/skills/remotion-markup/connected-compositions.md
@@ -7,7 +7,7 @@ Use connected composition when a section has its own layers or timing, will be r
1. Put the scene's markup in a named React component.
Multiple internal layers and sequences can live inside it.
-2. Prefer making the component interactive with `Interactive.withSchema({wrapInSequence: true})`, following [Remotion Interactivity](../remotion-interactivity/SKILL.md).
+2. Prefer making the component interactive with `Interactive.withSchema({wrapInSequence: true, layout: 'absolute-fill'})`, 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 `<TransitionSeries.Sequence>`.
@@ -40,22 +40,21 @@ import {
type ChapterProps = {
readonly title: string;
- readonly style?: React.CSSProperties;
};
-const ChapterInner: React.FC<ChapterProps> = ({title, style}) => {
+const ChapterInner: React.FC<ChapterProps> = ({title}) => {
// Frame 0 is the start of this chapter, wherever the parent places it.
const frame = useCurrentFrame();
return (
<AbsoluteFill
+ showInTimeline={false}
style={{
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
color: 'black',
fontFamily: 'Helvetica, Arial, sans-serif',
- ...style,
}}
>
<h1
@@ -81,10 +80,11 @@ export const Chapter = Interactive.withSchema({
componentName: '<Chapter>',
schema: chapterSchema,
wrapInSequence: true,
+ layout: 'absolute-fill',
});
```
-`ChapterInner` only declares `title` and `style`.
+`ChapterInner` only declares `title`. Its inner container handles the chapter's centering and background; the wrapper handles instance styles and timing.
Because of `wrapInSequence: true`, the exported `Chapter` additionally accepts the timing props of a `<Sequence>`: `from`, `durationInFrames`, `trimBefore`, `playbackRate`, `loop`, `freeze`, `hidden`, `name` and `showInTimeline`, plus `premountFor`, `postmountFor` and crop props.
These are handled by the wrapper and are not passed to `ChapterInner`.
See [Prefer interactive components with their own timelines](../remotion-interactivity/SKILL.md#prefer-interactive-components-with-their-own-timelines).
diff --git a/packages/skills/skills/remotion-markup/cropping.md b/packages/skills/skills/remotion-markup/cropping.md
index 751617ce90..1d4b4f7f73 100644
--- a/packages/skills/skills/remotion-markup/cropping.md
+++ b/packages/skills/skills/remotion-markup/cropping.md
@@ -7,7 +7,7 @@ The following components support `crop*` props:
- `<Sequence>` from `remotion`, when `layout="absolute-fill"`
- `<Interactive.*>` HTML and SVG elements from `remotion`
-- Custom components made with `Interactive.withSchema({wrapInSequence: true})` from `remotion`, when their `style` prop is forwarded to the visual root
+- Custom components made with `Interactive.withSchema({wrapInSequence: true})` from `remotion`, using a managed `layout: 'absolute-fill'` root or forwarding `style` to their own visual root
- `<CanvasImage>` from `remotion`
- `<Img>` from `remotion`
- `<AnimatedImage>` from `remotion`