Props turn a composition into a template. Declare default values in the composition's props, write
{{name}} wherever a value should come from a prop, and override any of them when you run a command.
They work like Remotion's defaultProps and input props.
{{name}} is for props only. Colors, type and motion shared by the whole project belong in the
theme, written "$color.accent".
{ "fonts": [ { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }, { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" } ], "compositions": [{ "id": "card", "description": "A title card driven by props: strings, a color, numbers and a nested object", "width": 1280, "height": 720, "fps": 30, "duration": "{{seconds}}", "background": "#f4f1ea", "props": { "name": "Ada Lovelace", "role": "First programmer", "accent": "#c92a26", "seconds": "4s", "nameSize": 104, "work": { "year": 1843, "title": "Note G" } }, "layers": [ { "id": "bar", "type": "rect", "anchor": "left", "x": 200, "y": "50%", "width": 8, "height": 220, "fill": "{{accent}}", "scaleY": { "from": 0, "to": 1, "duration": "0.6s", "ease": "easeOutCubic" } }, { "id": "name", "type": "text", "text": "{{name}}", "anchor": "left", "x": 246, "y": "43%", "font": "Schibsted Grotesk", "fontWeight": 860, "letterSpacing": -4.5, "fontSize": "{{nameSize}}", "fill": "#161412", "start": "0.2s", "enter": "fadeRight" }, { "id": "role", "type": "text", "text": "{{role}}", "anchor": "left", "x": 254, "y": "57%", "font": "JetBrains Mono", "fontSize": 24, "letterSpacing": 3, "uppercase": true, "fill": "{{accent}}", "start": "0.5s", "enter": "fadeRight" }, { "id": "meta", "type": "text", "text": "{{work.title}}, {{work.year}}", "anchor": "left", "x": 254, "y": "66%", "font": "JetBrains Mono", "fontSize": 20, "fill": "#8a857a", "start": "0.8s", "enter": "fade" } ] }]}The card above has six props. Rendering it for someone else needs no edit to the file:
vidmake render props-card.json -o out/grace.mp4 \ -p "name=Grace Hopper" -p "role=Compiler pioneer" -p accent=#1f5fb0 \ -p 'work={"year": 1952, "title": "A-0"}'
#Declaring props
props is an object on the composition. Its values are the defaults, and can be any JSON: strings,
numbers, booleans, arrays and nested objects.
{ "id": "card", "width": 1280, "height": 720, "duration": "{{seconds}}", "props": { "name": "Ada Lovelace", "accent": "#c92a26", "seconds": "4s", "nameSize": 104, "work": { "year": 1843, "title": "Note G" } }, "layers": [ ... ]}vidmake list prints each composition's default props, so the file documents its own inputs. A
composition's description is a good place to explain them.
#Referencing props
Write {{name}} inside any string value in the composition: layer fields, nested objects, arrays, and
composition fields such as duration and background. Spaces inside the braces are allowed
({{ name }}).
Dotted paths reach into objects and arrays: {{work.year}}, {{user.address.city}},
{{colors.0}} (array items by index).
#Whole value or spliced into text
How a placeholder is replaced depends on whether it is the entire string:
- The whole string (ignoring surrounding spaces): the placeholder is replaced by the prop's raw JSON value. Numbers stay numbers, booleans stay booleans, objects stay objects.
- Part of a longer string: the value is spliced into the text. Strings are inserted as they are; numbers, booleans, arrays and objects are inserted as compact JSON.
| prop value | written as | becomes |
|---|---|---|
"size": 80 | "fontSize": "{{size}}" | "fontSize": 80 (a number) |
"show": false | "visible": "{{show}}" | "visible": false |
"bg": { "type": "linear", "stops": ["#000", "#333"] } | "background": "{{bg}}" | the whole gradient object |
"name": "Ada" | "text": "Hello, {{name}}!" | "text": "Hello, Ada!" |
"size": 80 | "text": "Size {{size}}" | "text": "Size 80" |
"offset": 100 | "x": "=w/2 + {{offset}}" | "x": "=w/2 + 100", an expression |
"speed": 3 | "text": "${round(t * {{speed}})}" | live text counting at 3 per second |
"pos": [100, 200] | "text": "at {{pos}}" | "text": "at [100,200]" |
Props are substituted before anything else happens, so a spliced prop can become part of an
expression or a ${...} live-text template, as the last rows show.
Warning
"text": "{{count}}"with a number prop becomes"text": 42, and text must be a string:layer `count` (main > layers[1]): `text` must be a string or an array of spans. Add some text around it ("{{count}} items"), or make the prop a string ("count": "42").
#Unknown props
A placeholder whose name isn't a prop is left in place, so it shows up literally in the video, and
validate and timeline warn about it:
✓ card — 120 frames (4.00s) warning: composition `card`: unknown prop `{{nmae}}`#What props can't do
- Defaults can't reference other props.
{{...}}inside thepropsobject itself is not replaced. - Don't template the composition
id. Commands look compositions up by their literal id (--comp,use,list) before props are applied. - Keys aren't templated, only values:
"{{field}}": 1stays as written.
#Overriding props from the command line
Every command that compiles a composition accepts props: validate, timeline, inspect, trace,
still, storyboard and render.
| flag | example | notes |
|---|---|---|
-p key=value | -p title=Hi -p count=3 | repeatable. The value is parsed as JSON when it is valid JSON, otherwise taken as a string. Splits at the first = |
-p '<json object>', --props '<json object>' | --props '{"title": "Hi", "count": 3}' | the same flag also takes a whole JSON object |
--props-file <file> | --props-file grace.json | a JSON object read from a file |
With -p, count=3 gives the number 3, show=false the boolean, title=Hi the string "Hi",
title="3" (with JSON quotes, so 'title="3"' in a shell) the string "3", and
'work={"year": 1952}' an object. Quote values with spaces for your shell: -p "name=Grace Hopper".
Precedence: the composition's defaults, then --props-file, then each -p/--props in the order
given. A later value for the same key wins.
Important
Overrides replace top-level props whole; they are not merged into nested objects. With a default
"work": { "year": 1843, "title": "Note G" }, passing-p 'work={"year": 1952}'leaveswork.titleundefined, and{{work.title}}produces an unknown-prop warning. Pass the complete object.
Check an override before rendering, like anything else. timeline shows the resulting text and timing;
here seconds shortens the whole card to 3 seconds:
$ vidmake timeline props-card.json -p "name=Grace Hopper" -p seconds=3s
Composition `card` — 1280x720 @ 30fps, 90 frames (3.00s)
ID TYPE START END DUR DETAILS
bar rect 0.00s 3.00s 3.00s
name text 0.20s 3.00s 2.80s enter:fadeRight "Grace Hopper"
role text 0.50s 3.00s 2.50s enter:fadeRight "First programmer"
meta text 0.80s 3.00s 2.20s enter:fade "Note G, 1843"
|0s 1s 2s |
bar |████████████████████████████████████████████████████████████|
name |····████████████████████████████████████████████████████████|
role |··········██████████████████████████████████████████████████|
meta |················████████████████████████████████████████████|Editing commands (set, add, unset, rm) don't take props: they check the project with its default
props before saving.
#Many videos from one template
Keep one props file per variant and loop over them:
for f in people/*.json; do vidmake render card.json --props-file "$f" -o "out/$(basename "$f" .json).mp4" --json | tail -n 1done{ "name": "Grace Hopper", "role": "Compiler pioneer", "accent": "#1f5fb0", "work": { "year": 1952, "title": "A-0" } }#Props and components
A use layer renders another composition, and its props field sets that
composition's props for this instance. Each instance can pass different values; whatever it leaves out
falls back to the component's defaults.
{ "fonts": [ { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }, { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" } ], "compositions": [ { "id": "lineup", "description": "One component, three instances: each use layer passes its own props", "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea", "props": { "accent": "#c92a26" }, "layers": [ { "id": "heading", "type": "text", "text": "Speakers", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 72, "letterSpacing": -3, "fill": "#161412", "y": "16%" }, { "id": "ada", "type": "use", "ref": "speaker", "y": "38%", "start": "0.2s", "props": { "name": "Ada Lovelace", "topic": "Notes on the Engine", "color": "{{accent}}" } }, { "id": "grace", "type": "use", "ref": "speaker", "y": "58%", "start": "0.5s", "props": { "name": "Grace Hopper", "topic": "Compilers", "color": "#1f5fb0" } }, { "id": "alan", "type": "use", "ref": "speaker", "y": "78%", "start": "0.8s", "props": { "name": "Alan Turing", "topic": "Computable numbers" } } ] }, { "id": "speaker", "description": "Component: a speaker row. Props: name, topic, color", "width": 760, "height": 120, "fps": 30, "duration": "3.8s", "props": { "name": "Name", "topic": "Topic", "color": "#161412" }, "layers": [ { "id": "row", "type": "rect", "cornerRadius": 2, "fill": "#fbf9f4", "stroke": "#d8d1c1", "strokeWidth": 2, "enter": "fadeUp" }, { "id": "dot", "type": "ellipse", "x": 60, "width": 22, "fill": "{{color}}", "enter": "pop" }, { "id": "name", "type": "text", "text": "{{name}}", "anchor": "left", "x": 100, "y": "50%", "font": "Schibsted Grotesk", "fontWeight": 800, "fontSize": 42, "letterSpacing": -1.6, "fill": "#161412", "enter": "fadeUp" }, { "id": "topic", "type": "text", "text": "{{topic}}", "anchor": "right", "x": 730, "y": "50%", "font": "JetBrains Mono", "fontSize": 16, "letterSpacing": 2, "uppercase": true, "fill": "{{color}}", "enter": "fade" } ] } ]}{ "id": "grace", "type": "use", "ref": "speaker", "y": "58%", "start": "0.5s", "props": { "name": "Grace Hopper", "topic": "Compilers", "color": "#1f5fb0" } }Here alan passes no color, so it gets the component's default ink, and ada passes
"color": "{{accent}}".
The use layer is part of the parent composition, so {{...}} inside its props refers to the
parent's props. That is how a value flows from the command line down into a component:
vidmake render props-use.json -o out/lineup.mp4 -p accent=#1f5fb0 # recolors Ada's row onlyNote
Command-line props apply to the composition being rendered, not directly to the components it uses. To make a component configurable from outside, give the parent a prop and forward it, as
adadoes with"color": "{{accent}}".
#Design tokens
Props are the content of one composition: a name, a title, a number. Design tokens are the look of the whole
project: brand colors, type styles, spacing and motion. They live in the project's theme and
every composition, components included, reads them as "$color.accent" without forwarding anything:
{ "id": "title", "type": "text", "text": "{{title}}", "style": "$type.display", "fill": "$color.accent" }A prop can still pick a token: "fill": "{{color}}" with the prop "color": "$color.accent" resolves to the
accent color. See Theme for references, styles, modes and token files.
Note
In vidmake 0.5, tokens were a top-level
tokensobject read as{{color.accent}}. That still works with a warning;vidmake migrate project.jsonrewrites it to the theme. See From 0.5.
#From Remotion
| Remotion | vidmake |
|---|---|
defaultProps on <Composition> | the composition's props |
inputProps / --props on npx remotion render | --props, -p key=value, --props-file |
| reading a prop in a component | {{name}} in any string value |
| passing props to a child component | props on a use layer |
calculateMetadata from props | props in composition fields, e.g. "duration": "{{seconds}}" |