🎥 Make videos programmatically with React
Always wrap Interactive.create components in a sequence
Jonny Burger60cd6b4c2b54
diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsxindex 122343322f..504a1e1850 100644--- a/packages/core/src/Interactive.tsx+++ b/packages/core/src/Interactive.tsx@@ -287,13 +287,10 @@ type WithSchemaOptions<WithDefaults extends boolean,> = WithDefaults extends true? Omit<Options, 'schema' | 'componentName' | 'wrapInSequence'> &- Partial<Pick<Options, 'schema' | 'componentName'>> &- (Options extends {wrapInSequence: true}- ? {readonly wrapInSequence?: true}- : {readonly wrapInSequence: false})+ Partial<Pick<Options, 'schema' | 'componentName'>>: Options;-type WithSchema<WithDefaults extends boolean = false> = {+type WithSequence<WithDefaults extends boolean> = {<S extends InteractivitySchema, Component extends React.ElementType>(options: WithSchemaOptions<Omit<@@ -346,14 +343,14 @@ type WithSchema<WithDefaults extends boolean = false> = {InteractivePremountProps &InteractiveCropProps>;+};++type WithSchema = WithSequence<false> & {<S extends InteractivitySchema, Props extends object>(- options: WithSchemaOptions<- WithInteractivitySchemaOptions<S, Props> & {- readonly wrapInSequence?: false;- readonly layout?: never;- },- WithDefaults- >,+ options: WithInteractivitySchemaOptions<S, Props> & {+ readonly wrapInSequence?: false;+ readonly layout?: never;+ },): React.ComponentType<Props>;};@@ -535,17 +532,17 @@ const withSchema: WithSchema = (untypedOptions: unknown) => {>;};-const create: WithSchema<true> = (untypedOptions: unknown) => {+const create: WithSequence<true> = (untypedOptions: unknown) => {const options = untypedOptions as Omit<WithSchemaImplementationOptions,- 'schema' | 'componentName'+ 'schema' | 'componentName' | 'wrapInSequence' | 'supportsEffects'> &Partial<Pick<WithSchemaImplementationOptions, 'schema' | 'componentName'>>;return (withSchema as (options: WithSchemaImplementationOptions) => React.FC)({...options,- wrapInSequence: options.wrapInSequence ?? true,+ wrapInSequence: true,schema: options.schema ?? {},componentName:options.componentName ??@@ -732,7 +729,7 @@ export const Interactive = {withSchema,/*** @description Creates a component with timing props and editable Studio controls.- * Sequence wrapping defaults to true, schema defaults to {}, and componentName is inferred.+ * Always wraps the component in a sequence. The schema defaults to {} and componentName is inferred.* A trailing "Inner" is removed from inferred function names.* @see [Documentation](https://www.remotion.dev/docs/interactive-create)*/diff --git a/packages/docs/docs/interactive-create.mdx b/packages/docs/docs/interactive-create.mdxindex 9df83fa983..39c569bc4e 100644--- a/packages/docs/docs/interactive-create.mdx+++ b/packages/docs/docs/interactive-create.mdx@@ -9,7 +9,7 @@ crumb: 'API'Wraps a React component with [timing props](/docs/timing) and editable controls in the [Remotion Studio](/docs/studio).-Sequence wrapping is enabled by default. You can omit `schema` when the component has no custom controls.+The component is always wrapped in a [`<Sequence>`](/docs/sequence). A [`useCurrentFrame()`](/docs/use-current-frame) call inside the component reads its local frame. You can omit `schema` when the component has no custom controls.```tsx twoslash title="Circle.tsx"import type React from 'react';@@ -71,7 +71,7 @@ The options for `Interactive.create()` are:The component to wrap.-With sequence wrapping enabled and the default `layout: 'none'`, it must accept a `style?: React.CSSProperties` prop and apply it to its visual root.+With the default `layout: 'none'`, it must accept a `style?: React.CSSProperties` prop and apply it to its visual root.With `layout: 'absolute-fill'`, the wrapper applies styles to a full-size container instead. `Component` must not declare `style`, `width`, or `height` props; these belong to the wrapper.### `componentName`?@@ -88,23 +88,13 @@ Set the returned component's [`name`](/docs/sequence#name) prop to label an indiAn [`InteractivitySchema`](/docs/interactivity-schema) that describes which custom props are editable in Remotion Studio. Defaults to `{}`. Props that are not in the schema still work in code.-With sequence wrapping enabled, timing, premounting, cropping, and transform controls are included automatically. You do not need to add their schema fragments.+Timing, premounting, cropping, and transform controls are included automatically. You do not need to add their schema fragments.See: [Make a component interactive](/docs/studio/make-component-interactive#create-a-schema)-### `wrapInSequence`?--Defaults to `true`. Wraps the component in a [`<Sequence>`](/docs/sequence) and adds timing, premounting, and cropping props. A [`useCurrentFrame()`](/docs/use-current-frame) call inside the component reads its local frame.--Set to `false` only when the component already handles its own sequence and forwards its controls and timing props. In this mode, `Interactive.create()` preserves the component's props, uses the schema as supplied, and does not add timing props or standard schema fragments. `layout` must be omitted.--### `supportsEffects`?--Only available, and required, when `wrapInSequence` is `false`. Declares whether the component supports effect controls. Set to `false` for components that do not handle effects.-### `layout`?-Available when sequence wrapping is enabled. Defaults to `'none'`, which forwards styles to `Component` without adding a container.+Defaults to `'none'`, which forwards styles to `Component` without adding a container.Set to `'absolute-fill'` to give the component a full-size, absolutely positioned container with `overflow: 'hidden'` by default. Set `style={{overflow: 'visible'}}` on the returned component to let content extend beyond its bounds. Styles, transforms, cropping, and premount styles apply to this container. It shares the component's timeline item, so no extra layout layer appears in Studio. The returned component also accepts `width` and `height` to size the container and set the dimensions reported by `useVideoConfig()`.@@ -150,7 +140,7 @@ Keep `'none'` when styles need to apply directly to an element with its own size### Return value-Returns a React component with the original component's props and, by default, timing, premounting, and cropping props.+Returns a React component with the original component's props and timing, premounting, and cropping props.With `layout: 'absolute-fill'`, the returned component also accepts `style`, `width`, and `height`. These props belong to the wrapper and must not be declared by the inner component. The inner component must not declare the timing, premounting, or cropping props managed by the wrapper either.@@ -162,9 +152,9 @@ With `layout: 'absolute-fill'`, the ref points to the wrapper's `HTMLDivElement`## Migrating from `Interactive.withSchema()`-Replace `Interactive.withSchema()` with `Interactive.create()`. You can remove `wrapInSequence: true`, an empty `schema`, and a `componentName` that matches the inferred name. Keep explicit names when they should remain unchanged.+For calls with `wrapInSequence: true`, replace `Interactive.withSchema()` with `Interactive.create()` and remove `wrapInSequence`. You can also remove an empty `schema` and a `componentName` that matches the inferred name. Keep explicit names when they should remain unchanged.-If the old call omitted `wrapInSequence` or set it to `false`, explicitly pass `wrapInSequence: false` to preserve its behavior. The default changed from `false` to `true`.+If the old call omitted `wrapInSequence` or set it to `false`, keep using `Interactive.withSchema()` to preserve its behavior. Components that manage their own sequencing still need that API. `Interactive.create()` always adds a sequence and does not accept `wrapInSequence`.## Compatibilitydiff --git a/packages/docs/docs/interactive-with-schema.mdx b/packages/docs/docs/interactive-with-schema.mdxindex d4dbd31afc..92037a6f3a 100644--- a/packages/docs/docs/interactive-with-schema.mdx+++ b/packages/docs/docs/interactive-with-schema.mdx@@ -8,7 +8,7 @@ crumb: 'API'# ~~Interactive.withSchema()~~<AvailableFrom v="4.0.530" />:::info Deprecated-Use [`Interactive.create()`](/docs/interactive-create) instead, available from <AvailableFrom v="4.0.536" inline />. It enables sequence wrapping by default and makes `schema` and `componentName` optional. See the [migration guide](/docs/interactive-create#migrating-from-interactivewithschema) before replacing calls that omit `wrapInSequence`.+Use [`Interactive.create()`](/docs/interactive-create) instead, available from <AvailableFrom v="4.0.536" inline />. It always wraps the component in a sequence and makes `schema` and `componentName` optional. See the [migration guide](/docs/interactive-create#migrating-from-interactivewithschema) before replacing calls that omit `wrapInSequence`.:::Wraps a React component so Remotion Studio shows it as interactive.diff --git a/packages/docs/docs/interactive.mdx b/packages/docs/docs/interactive.mdxindex 0aefe3fc9e..1a375c88a9 100644--- a/packages/docs/docs/interactive.mdx+++ b/packages/docs/docs/interactive.mdx@@ -176,7 +176,7 @@ It includes `Interactive.baseSchema` and a `layout` field. When `layout` is `"ab### `Interactive.create()`<AvailableFrom v="4.0.536" />-Wraps a custom component with timing props and editable Studio controls. Sequence wrapping is enabled by default; `schema` and `componentName` are optional.+Wraps a custom component with timing props and editable Studio controls. The component is always wrapped in a sequence; `schema` and `componentName` are optional.See [`Interactive.create()`](/docs/interactive-create).diff --git a/packages/docs/docs/studio/make-component-interactive.mdx b/packages/docs/docs/studio/make-component-interactive.mdxindex 6385bcd9cb..e63b998905 100644--- a/packages/docs/docs/studio/make-component-interactive.mdx+++ b/packages/docs/docs/studio/make-component-interactive.mdx@@ -8,7 +8,7 @@ crumb: 'Remotion Studio'Remotion's default components are already interactive, meaning they can be selected and edited in the Studio.-To make your component interactive too, wrap it with [`Interactive.create()`](/docs/interactive-create), available from <AvailableFrom v="4.0.536" inline />. Sequence wrapping is enabled by default. Omit `schema` if you only need the built-in timing, transform, premounting, and cropping controls.+To make your component interactive too, wrap it with [`Interactive.create()`](/docs/interactive-create), available from <AvailableFrom v="4.0.536" inline />. The component is always wrapped in a sequence. Omit `schema` if you only need the built-in timing, transform, premounting, and cropping controls.## Create the componentdiff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.mdindex e1dc512ccb..7f2443f696 100644--- a/packages/skills/skills/remotion-interactivity/SKILL.md+++ b/packages/skills/skills/remotion-interactivity/SKILL.md@@ -15,7 +15,7 @@ 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.create()` from Remotion 4.0.536 onwards. Sequence wrapping defaults to `true`, and `schema` defaults to `{}`, so omit both when no custom controls are needed. `componentName` is optional: it uses `Component.displayName`, then the function name with a trailing `Inner` removed, then `"Component"`. Explicit names and display names are preserved.+Use `Interactive.create()` from Remotion 4.0.536 onwards. It always wraps the component in a sequence; there is no `wrapInSequence` option. The `schema` defaults to `{}`, so omit it when no custom controls are needed. `componentName` is optional: it uses `Component.displayName`, then the function name with a trailing `Inner` removed, then `"Component"`. Explicit names and display names are preserved.Use `Interactive.create({layout: 'absolute-fill'})` for components that fill their parent. The wrapper provides their visual root and timeline item, and clips overflow by default, so the inner component can return a fragment. Put timing, dimensions, and per-instance styles on the exported component.@@ -94,7 +94,7 @@ Every field needs a `default` and should have a `description`, which Studio showSet `keyframable: false` to show a static control.Expose content and per-instance appearance, such as the text and an accent color.-Do not add fields for `style.translate`, `style.scale`, `style.rotate`, `style.transformOrigin` and `style.opacity`: `Interactive.create()` adds them by default.+Do not add fields for `style.translate`, `style.scale`, `style.rotate`, `style.transformOrigin` and `style.opacity`: `Interactive.create()` adds them automatically.To make CSS properties of the root editable per instance, spread the built-in schema fragments:@@ -130,7 +130,7 @@ its parent. SeeRegister the same exported component reference that the parent renders. For theexample above, use `component={Scene}`, not `SceneInner` or an inline wrapper.-`Interactive.create()` provides the sequence by default, so no extra `<Sequence>` is needed for the connection.+`Interactive.create()` provides the sequence, so no extra `<Sequence>` is needed for the connection.```tsx title="src/Root.tsx"import {Composition} from 'remotion';diff --git a/packages/skills/skills/remotion-markup/connected-compositions.md b/packages/skills/skills/remotion-markup/connected-compositions.mdindex 0a4303c7db..b551d3a4b9 100644--- a/packages/skills/skills/remotion-markup/connected-compositions.md+++ b/packages/skills/skills/remotion-markup/connected-compositions.md@@ -83,7 +83,7 @@ export const Chapter = Interactive.create({````ChapterInner` only declares `title`. The Chapter background layer exposes the centering and background styles in the timeline; the wrapper handles instance styles and timing.-Because `Interactive.create()` wraps the component in a sequence by default, 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.+Because `Interactive.create()` always wraps the component in a sequence, 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).