Skip to main content

saveDefaultProps()v4.0.147

Saves the defaultProps for a composition back to the root file. updateDefaultProps() is an alias for this function.

Examples

Saving {color: 'green'} to Root.tsx
import { saveDefaultProps } from "@remotion/studio"; await saveDefaultProps({ compositionId: "my-composition", defaultProps: () => { return { color: "green", }; }, });

You can access the saved default props to only override part of it (reducer-style):

Accessing the saved default props
import { saveDefaultProps } from "@remotion/studio"; await saveDefaultProps({ compositionId: "my-composition", defaultProps: ({ savedDefaultProps }) => { return { ...savedDefaultProps, color: "green", }; }, });

If you have a Zod schema, you can also access its runtime value:

Accessing the Zod schema
import { saveDefaultProps } from "@remotion/studio"; await saveDefaultProps({ compositionId: "my-composition", defaultProps: ({ schema, savedDefaultProps }) => { // Do something with the Zod schema return { ...savedDefaultProps, color: "red", }; }, });

unsavedDefaultProps

info

Before v4.0.437, the Props Editor had a concept of "unsaved props" that were not yet written back to the root file. Starting from v4.0.437, all prop changes are immediately saved, so unsavedDefaultProps is now always the same as savedDefaultProps.

It is still accepted for backwards compatibility, but you should use savedDefaultProps instead.

Requirements

In order to use this function:

You need to be inside the Remotion Studio.


The Studio must be running (no static deployment)


zod needs to be installed.



Otherwise, the function will throw.

See also