Interactive.withSchema()v4.0.479
Wraps a React component so Remotion Studio can expose its props as timeline controls.
Use it when you build a component that should behave like <Sequence>, <Solid> or <CanvasImage>: The component appears in the timeline, can expose editable controls and can receive saved values from the Studio.
Example
Circle.tsximport {forwardRef ,useImperativeHandle ,useRef } from 'react'; import {Interactive ,Sequence , typeInteractiveBaseProps , typeInteractiveTransformProps , typeSequenceControls , typeInteractivitySchema , } from 'remotion'; typeCircleProps =InteractiveBaseProps &InteractiveTransformProps & { readonlyradius ?: number; readonlycolor ?: string; }; constcircleSchema = { ...Interactive .baseSchema ,radius : {type : 'number',min : 1,step : 1,default : 80,description : 'Radius',hiddenFromList : false, },color : {type : 'color',default : '#0b84ff',description : 'Color', }, ...Interactive .transformSchema , } asconst satisfiesInteractivitySchema ; constCircleInner =forwardRef <HTMLDivElement ,CircleProps & { readonlycontrols :SequenceControls | undefined; } >( ( {radius = 80,color = '#0b84ff',name ,style ,controls , ...sequenceProps },ref , ) => { constoutlineRef =useRef <HTMLDivElement >(null);useImperativeHandle (ref , () =>outlineRef .current asHTMLDivElement , []); return ( <Sequence layout ="none" {...sequenceProps }name ={name ?? '<Circle>'}controls ={controls }outlineRef ={outlineRef } > <div ref ={outlineRef }style ={{ ...style ,width :radius * 2,height :radius * 2,borderRadius : '50%',backgroundColor :color , }} /> </Sequence > ); }, ); export constCircle =Interactive .withSchema ({Component :CircleInner ,componentIdentity : 'com.example.Circle',schema :circleSchema ,supportsEffects : false, });
The exported Circle component only accepts CircleProps. The controls prop is passed by Interactive.withSchema() to the inner component and should be forwarded to the <Sequence> that represents the component in the timeline.
If you use <Sequence layout="none">, pass outlineRef so the Studio can draw a canvas outline around the rendered element.
API
import {Interactive } from 'remotion';Call Interactive.withSchema() with an options object.
Component
The component to wrap.
It must accept its public props plus controls.
controls
The control state created by Interactive.withSchema().
Forward it to the <Sequence> that registers the component in the timeline.
schema
An InteractivitySchema that describes which props are editable in Remotion Studio.
Use Interactive.baseSchema for Sequence-like timeline props. Use Interactive.transformSchema if the component accepts a style prop and should expose transform controls.
componentIdentity
A stable string that identifies the component type.
Use reverse-DNS style names such as "com.example.Circle". Pass null if the component should not be identified for source updates.
supportsEffects
Set to true if this component supports an effects prop. Otherwise, set it to false.
Return value
Returns a component with the public props of Component.
Behavior
During rendering, in the Player and in read-only Studio sessions, Interactive.withSchema() renders the component with the original props.
In editable Studio sessions, it reads the current prop values, applies timeline overrides and passes the merged props to the inner component.