packages/docs/examples/submit-an-example.mdx
Have a small, remixable Remotion example? We'd love to see it.
Examples should be submitted with code. A strong submission is easy to preview, easy to copy into a Remotion project, and useful as a building block in real videos.
An example should ideally be a single, self-contained TSX file.
Each example should live in its own folder: packages/docs/examples/<category>/<slug>/.
Put the MDX page at packages/docs/examples/<category>/<slug>/index.mdx and the TSX source next to it.
Start from the reusable template in packages/docs/examples-template/.
The MDX page imports that TSX file for the live preview, and shows the exact same code in a fenced tsx code block. Keeping the displayed code inline (rather than generating it at build time) means both readers in the browser and AI agents reading the served Markdown see the full source. A test (src/test/examples.test.ts) enforces that the code block stays identical to the source file.
The preferred format is:
width, height, fps, and durationInFrames<Composition> directly in the fileFor example:
import {Composition} from 'remotion';
export const width = 1920;
export const height = 1080;
export const fps = 30;
export const durationInFrames = 120;
export const MyExample = () => {
return <div>...</div>;
};
export const RemotionRoot = () => {
return (
<Composition
id="MyExample"
component={MyExample}
width={width}
height={height}
fps={fps}
durationInFrames={durationInFrames}
/>
);
};
The MDX page can then use the shared page template, which renders a preview, a "Use it" section, and the source code:
import {ExamplePage} from '@site/src/components/Examples/ExamplePage';
import {
MyExample,
durationInFrames,
fps,
height,
width,
} from './my-example';
<ExamplePage
component={MyExample}
durationInFrames={durationInFrames}
fps={fps}
height={height}
width={width}
>
```tsx twoslash title="my-example.tsx"
// Paste the full contents of my-example.tsx here.
// It must match the file exactly — a test enforces this.
```
</ExamplePage>
The fenced code block must be an exact copy of the colocated TSX file. This is intentional: it keeps the source visible in the served Markdown for agents while the imported module powers the live preview.
If an example needs binary assets, they should be referenced by URL:
const imageUrl = 'https://remotion.media/example-image.png';
const videoUrl = 'https://remotion.media/example-video.mp4';
A good example is:
When submitting an example as a pull request, include:
packages/docs/examples/<category>/<slug>/index.mdx page and the single-file TSX source code in that folderThese are usually less suitable:
Submit examples by opening a pull request against the Remotion repository.