🎥 Make videos programmatically with React
Add Element contributor guidelines (#9179)
Igor Samokhovetsfa7512727890
diff --git a/.agents/skills/publish-element/SKILL.md b/.agents/skills/publish-element/SKILL.mdindex 2a1ed53682..80255d9260 100644--- a/.agents/skills/publish-element/SKILL.md+++ b/.agents/skills/publish-element/SKILL.md@@ -5,9 +5,9 @@ description: Finalize a developed Remotion Element, add it to the docs gallery,# Publish a Remotion Element-The source of truth is the [Element contributor guide](../../../packages/docs/elements/submit-an-element.mdx). Read it completely before making changes and follow it for all acceptance criteria. If this skill and the guide diverge, follow the guide.+The source of truth for design and quality criteria is the [Element Guidelines](../../../packages/docs/elements/guidelines.mdx). Read them completely before making changes. If this skill and the guidelines diverge on acceptance criteria, follow the guidelines.-This skill starts with an Element scaffold created by the [`new-element` skill](../new-element/SKILL.md). It does not create the initial development scaffold.+This skill owns the technical publication workflow. It starts with an Element scaffold created by the [`scaffold-element` skill](../scaffold-element/SKILL.md) and does not create the initial development scaffold.## 1. Confirm the Element is ready@@ -16,7 +16,7 @@ Confirm these files and the matching entry in `packages/docs/src/components/Elem- `packages/docs/elements/<category>/<slug>/index.mdx`- `packages/docs/elements/<category>/<slug>/<slug>.tsx`-Do not launch the Studio from this skill. Ask the developer to confirm that they developed and reviewed `element-<category>-<slug>` in the docs Remotion Studio. If more visual development is needed, give them these commands and stop the publishing workflow:+Do not launch the Studio from this skill. Before continuing, require the developer to explicitly confirm that they visually reviewed `element-<category>-<slug>` in the docs Remotion Studio and that it looks correct. Do not infer approval from completed tests or from the agent's own inspection. If the developer has not approved it or more visual development is needed, give them these commands and stop the publishing workflow:```bashbun run build@@ -26,7 +26,9 @@ bun run remotion## 2. Perform the publication review-Review the finished source, MDX page, and central definition against the contributor guide. Resolve placeholder content and finalize the description, display name, contributors, dimensions, duration, preview padding, and poster frame.+Review the finished source, MDX page, and central definition against the Element Guidelines. Resolve placeholder content and finalize the description, display name, contributors, dimensions, duration, preview padding, and poster frame.++Re-check the technical implementation requirements from the [`scaffold-element` skill](../scaffold-element/SKILL.md): The reusable implementation must remain in one self-contained TSX file, fill its configured bounds without a wrapper `<Sequence>` or preview-only source padding, and leave outer placement to the surrounding project. Animated entrances must have exits with inline, hardcoded frame ranges on useful named `Interactive.*` elements. Inner control names must not repeat the Element display name.When the Element has Studio-editable controls, also review it using the [interactivity best practices skill](../interactivity-best-practices/SKILL.md).@@ -58,7 +60,7 @@ bun test src/test/elements.test.ts## 5. Render and inspect the previews-Perform the preview verification required by the contributor guide:+Perform the preview verification required by the Element Guidelines:```bashcd packages/docs@@ -66,7 +68,9 @@ bun run render-element-previewscd ../..```-Inspect `packages/docs/.element-previews/<category>/<slug>/preview.png` and `preview.mp4`, and give those paths to the developer for review. This command renders every Element and clears the previous preview output. Do not commit the ignored output or pass `--upload` unless uploading was explicitly requested and maintainer R2 credentials are available.+Inspect `packages/docs/.element-previews/<category>/<slug>/preview.png` and `preview.mp4`, then give both paths to the developer for visual review. Stop and wait for the developer to explicitly confirm that both previews look correct. Do not run the final repository checks or finish the publishing workflow until that approval is received.++This command renders every Element and clears the previous preview output. Do not commit the ignored output or pass `--upload` unless uploading was explicitly requested and maintainer R2 credentials are available.## 6. Run final repository checksdiff --git a/.agents/skills/new-element/SKILL.md b/.agents/skills/scaffold-element/SKILL.mdsimilarity index 65%rename from .agents/skills/new-element/SKILL.mdrename to .agents/skills/scaffold-element/SKILL.mdindex 9b5438cc62..6b65d44caa 100644--- a/.agents/skills/new-element/SKILL.md+++ b/.agents/skills/scaffold-element/SKILL.md@@ -1,21 +1,21 @@----name: new-element+name: scaffold-elementdescription: Scaffold a new Remotion Element with a correctly configured preview composition for development in the docs Remotion Studio.----# Start a new Remotion Element+# Scaffold a Remotion Element-The source of truth is the [Element contributor guide](../../../packages/docs/elements/submit-an-element.mdx). Read it completely before making changes and follow it for all design and implementation decisions. If this skill and the guide diverge, follow the guide.+The source of truth for design and quality criteria is the [Element Guidelines](../../../packages/docs/elements/guidelines.mdx). Read them completely before making changes. If this skill and the guidelines diverge on acceptance criteria, follow the guidelines.-This skill prepares a development scaffold. Use the [`publish-element` skill](../publish-element/SKILL.md) when the Element is ready for the gallery.+This skill owns the technical scaffolding workflow. Use the [`publish-element` skill](../publish-element/SKILL.md) when the Element is ready for the gallery.## 1. Plan the previewChoose an existing category and a kebab-case slug. Before creating files, determine the initial preview metadata needed for development:- Composition width, height, fps, and duration-- Fixed Element width and height, or `null` for both-- Preview padding+- Fixed Element width and height, or `null` for both so it inherits the composition dimensions+- Preview padding, which affects only the docs preview and not the Element bounds- A provisional poster frameInspect `packages/docs/elements-template/` and at least one existing Element in the same category. Do not create a new category unless the task explicitly requires one.@@ -33,7 +33,9 @@ mv packages/docs/elements/<category>/<slug>/element.tsx \Adapt the copied `index.mdx` to the production pattern: import `elementDefinitions`, use its `'<category>/<slug>'` entry, and set `sourceFile="./<slug>.tsx"`.-Implement only enough of the component to provide a visible starting point in the intended bounds. Follow the contributor guide for the component itself. When using Studio-editable controls, also follow the [interactivity best practices skill](../interactivity-best-practices/SKILL.md).+Implement only enough of the component to provide a visible starting point in the intended bounds. Keep the reusable implementation in one self-contained TSX source file. Make the component fill its bounds without adding a wrapper `<Sequence>` or source padding for the preview. Do not use `left`, `right`, `top`, or `bottom` to place the Element itself; the surrounding project owns placement.++Follow the Element Guidelines for the component itself. When using Studio-editable controls, also follow the [interactivity best practices skill](../interactivity-best-practices/SKILL.md). Keep entrance and exit keyframes inline with hardcoded frame ranges on the useful named `Interactive.*` element so they can be adjusted in Studio. Do not repeat the Element display name in inner control names.## 3. Register the development compositiondiff --git a/packages/docs/elements-sidebars.ts b/packages/docs/elements-sidebars.tsindex 0ce656f509..b5719c671e 100644--- a/packages/docs/elements-sidebars.ts+++ b/packages/docs/elements-sidebars.ts@@ -4,6 +4,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';const sidebars: SidebarsConfig = {elementsSidebar: ['index',+ 'guidelines','submit-an-element',{type: 'html',diff --git a/packages/docs/elements/guidelines.mdx b/packages/docs/elements/guidelines.mdxnew file mode 100644index 0000000000..bf43958470--- /dev/null+++ b/packages/docs/elements/guidelines.mdx@@ -0,0 +1,59 @@+---+title: Element Guidelines+sidebar_label: Guidelines+description: Guidelines for creating useful, portable Remotion Elements.+---++# Element Guidelines++A Remotion Element should be a focused, reusable video building block that can be copied into a project and remixed.++Use these guidelines when designing and reviewing an Element.++## Keep it focused++An Element should demonstrate one visual idea, technique, or workflow. It should be useful in more than one Remotion project without becoming a complete, highly specific composition.++If two variants are worth showing, prefer two separate Elements over a variant prop.++The Elements gallery provides the preview dimensions, frame rate, and duration. The Element itself should remain a building block.++## Make it portable++An Element should work when it is dragged or copied into another project.++- Keep the implementation self-contained.+- Prefer HTML, CSS, and React.+- Avoid unexpected global styles and layout side effects.+- Avoid fullscreen assumptions unless the Element is a background.+- Use stable remote URLs for assets and Google Fonts for non-websafe fonts.+- Avoid project-specific branding or footage, and make colors easy to change.+- Avoid dependencies where possible. [Remotion Effects](/docs/effects) are an acceptable exception.++## Design it for composition++An Element should be safe to combine with other content using normal Studio layering.++Size it to the smallest useful bounding box. Let the surrounding [`<Sequence>`](/docs/sequence) control its placement and how long it appears in the video.++Do not add internal padding solely to improve the gallery preview. Preview spacing should not change the bounds of the Element when it is dragged into a project.++## Make animations complete++If an Element has an entrance animation, it must also have an exit animation.++Animate values within the Element, such as translation, scale, and opacity. Placement in the video belongs to the surrounding `<Sequence>`.++## Expose useful Studio controls++Only expose controls that make the Element meaningfully editable. Give each interactive object a descriptive name and avoid redundant nested controls for the same visual object.++The main editable object should usually have a generic name such as `Container`. Add named child controls only when the child represents a separately useful editing target.++Follow the [interactivity best practices](/docs/studio/interactivity-best-practices) when making an Element editable in Studio.++## Choose a representative preview++Choose a poster frame that shows the Element in a visible, representative state. The video preview should cover the complete configured duration, including entrance and exit animations.++When the Element satisfies these guidelines, see [Submit an Element](/elements/submit-an-element).diff --git a/packages/docs/elements/index.mdx b/packages/docs/elements/index.mdxindex a13cd1a612..4d7f1bb25f 100644--- a/packages/docs/elements/index.mdx+++ b/packages/docs/elements/index.mdx@@ -16,25 +16,8 @@ Remotion Elements are drop-in, HTML-first Remotion components designed to be plaThey are practical video building blocks: captions, lower thirds, overlays, callouts, transitions, data cards, audio visuals, and title cards.-## Methodology+Browse the categories in the sidebar to find an Element for your project.-An Element should be:--- Building block for a video: an overlay, transition, motion graphic, data animation, etc.-- Designed to live inside one `<Sequence>`-- Free of specific colors or branding, so users can easily remix it-- HTML, CSS, and React-first-- Zero-dependency where possible, with [Remotion Effects](/docs/effects) as an exception-- Safe to compose in Studio with normal z-layering-- Free of unexpected global styles, layout side effects, and fullscreen assumptions unless it is explicitly a background-- Sized to the smallest useful bounding box; placement in a video should come from the surrounding `<Sequence>`, not from internal padding or fullscreen wrappers--Heavier Maps, Three.js, WebGL, Canvas, and R3F Elements can come later as separate batches of work.--## What belongs here?--Elements should focus on one visual idea, technique, or workflow. They should be actionable Remotion building blocks rather than full, highly specific video templates.--Initial categories include Text, Captions, Overlays, Transitions, Backgrounds, Data, and Audio.+To learn what makes a useful, portable Element, read the [Element Guidelines](/elements/guidelines).If you want to contribute one, see [Submit an Element](/elements/submit-an-element).diff --git a/packages/docs/elements/submit-an-element.mdx b/packages/docs/elements/submit-an-element.mdxindex 4d690127ab..d2aeb55440 100644--- a/packages/docs/elements/submit-an-element.mdx+++ b/packages/docs/elements/submit-an-element.mdx@@ -7,211 +7,22 @@ description: Submit a Remotion Element for the Elements gallery.Have a small, remixable Remotion Element? We'd like to see it.-Follow this checklist from top to bottom when preparing an Element.+Before starting, read the [Element Guidelines](/elements/guidelines). They describe the design and quality criteria for Elements.-## 1. Choose a focused idea+## Use the Agent Skills-A strong Element can be previewed, copied into a Remotion project, and used as a video building block.+Two [Agent Skills](/docs/ai/skills) are available in the Remotion repository. They contain the technical workflow, including file layout, metadata, previews, and validation:-Good Elements are:+- Use the [`scaffold-element` Agent Skill](https://github.com/remotion-dev/remotion/blob/main/.agents/skills/scaffold-element/SKILL.md) to scaffold and register an Element for development.+- Use the [`publish-element` Agent Skill](https://github.com/remotion-dev/remotion/blob/main/.agents/skills/publish-element/SKILL.md) after developing and reviewing the Element in Remotion Studio. It adds the Element to the gallery, renders its previews, and runs the final checks.-- Focused on one visual idea, technique, or workflow-- Copy-pastable and useful in more than one Remotion project-- Remixable-- Equipped with both entrance and exit animations, if animated-- HTML, CSS, and React-first-- Free of unexpected global styles, layout side effects, and fullscreen assumptions unless it is explicitly a background-- **Building blocks, not compositions:** The hosted docs page provides the preview size, frame rate, and duration.+Ask your coding agent to use the appropriate skill. The workflows are separate so you can develop and review an Element before preparing it for publication.-If two variants are worth showing, make two separate Element pages instead of adding a variant prop.--## 2. Create the Element files--Start from the reusable template in `packages/docs/elements-template/`.--Add:--- An Element folder in `packages/docs/elements/<category>/<slug>/`-- An `index.mdx` page-- One self-contained TSX source file exporting a React component-- An entry in `packages/docs/src/components/Elements/element-definitions.ts`--For example:--```tsx twoslash title="Element.tsx"-export const MyElement = () => {- return <div style={{width: '100%', height: '100%'}}>...</div>;-};-```--## 3. Ensure portability--The source file should work when dragged or copied into a project.--- Must be a self-contained TSX file-- Assets must be remote with stable public URLs, no local ones-- Non-websafe fonts must be loaded through Google Fonts-- No highly branded videos--## 4. Define size--To give an Element a fixed size, set `elementWidth` and `elementHeight` in its definition entry. Use `null` for both values if the Element should inherit the full composition dimensions.--```tsx title="element-definitions.ts"-export const elementDefinitions = {- // The object key must match the slug.- 'overlays/my-element': {- // Other metadata...- slug: 'overlays/my-element',- elementWidth: 900,- elementHeight: 260,- previewPadding: 120,- },-};-```--Then make the Element fill that area in its source file:--```tsx title="my-element.tsx"-import {AbsoluteFill} from 'remotion';--export const MyElement = () => {- return <AbsoluteFill>...</AbsoluteFill>;-};-```--Size the Element to the smallest useful bounding box.--Use `previewPadding` in the definition entry if the docs preview needs more breathing room without changing the Element's drag dimensions or adding source padding.--Do not put the wrapper [`<Sequence>`](/docs/sequence) into the Element source file.--## 5. Separate placement from animation--Let the Studio-inserted [`<Sequence>`](/docs/sequence) handle placement in the video.-Don't use `left`, `right`, `top`, and `bottom`, etc. to position your element.--Inner Element styles can animate entrance and exit values such as `translate`, `scale`, and `opacity`.--For animation, keep the timing inside the component but let the surrounding project decide how long the Element appears.--If an Element has an entrance animation, it must also have an exit animation. Keep both sets of keyframes inline on an `Interactive.*` element with hardcoded frame ranges, so users can adjust their timing in the Studio:--```tsx twoslash title="AnimatedElement.tsx"-import {Interactive, interpolate, useCurrentFrame} from 'remotion';--export const AnimatedElement = () => {- const frame = useCurrentFrame();-- return (- <Interactive.Div- name="Container"- style={{- width: '100%',- height: '100%',- opacity: interpolate(frame, [0, 20, 70, 90], [0, 1, 1, 0], {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- }),- translate: interpolate(frame, [0, 20, 70, 90], ['0px 40px', '0px 0px', '0px 0px', '0px -40px'], {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- }),- }}- >- Hello- </Interactive.Div>- );-};-```--## 6. Add interactivity where useful--Only add `Interactive.*` wrappers when they expose useful Studio controls.-Every `Interactive.*` wrapper should have a descriptive `name`.--Avoid:--- Redundant nested `Interactive.*` wrappers that represent the same visual object-- Repeating the Element display name inside source names; the dragged wrapper already gets named from `displayName`--For the main inner editable element, use a generic name such as `Container`.--You should follow [Interactivity best practices](/docs/studio/interactivity-best-practices).--For a single editable object, use one named wrapper:--```tsx twoslash title="Single editable object"-import {Interactive, interpolate, useCurrentFrame} from 'remotion';--export const Badge = () => {- const frame = useCurrentFrame();-- return (- <Interactive.Div- name="Container"- style={{- opacity: interpolate(frame, [0, 20], [0, 1]),- translate: interpolate(frame, [0, 20], ['0px 24px', '0px 0px']),- padding: 24,- borderRadius: 16,- backgroundColor: 'white',- }}- >- Launch day- </Interactive.Div>- );-};-```--If a child has separate useful controls, make the child interactive and name it:--```tsx twoslash title="Named child controls"-import {Interactive} from 'remotion';--export const Badge = () => {- return (- <Interactive.Div- name="Container"- style={{- padding: 24,- borderRadius: 16,- backgroundColor: 'white',- }}- >- <Interactive.Div- name="Title"- style={{- color: 'black',- fontSize: 44,- fontWeight: 700,- }}- >- Launch day- </Interactive.Div>- </Interactive.Div>- );-};-```--## 7. Check the preview assets--Set an intentional `posterFrame` in the definition entry. It should show the Element in a representative, visible state.--Render the PNG and MP4 locally:--```bash-cd packages/docs-bun run render-element-previews-```--Inspect both files under `.element-previews/`. The MP4 should cover the Element's full configured duration. Production uploads require maintainer R2 credentials.--## 8. Open the pull request+## Open the pull requestWhen submitting an Element as a pull request, include:-- The Element folder and definition entry+- The Element implementation, page, and gallery registration- What makes it useful- The rendered preview- Links to inspiration, if any