🎥 Make videos programmatically with React
`docs`: Complete Element metadata authoring support (#10023)
Igor Samokhovets3102b29a9ddd
diff --git a/.agents/skills/publish-element/SKILL.md b/.agents/skills/publish-element/SKILL.mdindex 7594cbb164..22ebb37b45 100644--- a/.agents/skills/publish-element/SKILL.md+++ b/.agents/skills/publish-element/SKILL.md@@ -26,7 +26,7 @@ bun run remotion## 2. Perform the publication review-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, poster frame, and `preview` object. Confirm that `posterUrl` and `videoUrl` use flat `https://remotion.media/elements/<category>-<slug>-preview.png` and `.mp4` paths. Preview assets are composited onto the standard background and use MP4 for broad browser, social-card, and embed compatibility, even when the Element itself supports transparency. These explicit URLs are the publishing source of truth.+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, declared dependencies, preview padding, poster frame, and `preview` object. Confirm that `durationInFrames` is appropriate for both the preview and the `<Sequence>` installed into Studio, and that every external source import except `react`, `react-dom`, and `remotion` appears in `dependencies` with an exact version only when required. Confirm that `posterUrl` and `videoUrl` use flat `https://remotion.media/elements/<category>-<slug>-preview.png` and `.mp4` paths. Preview assets are composited onto the standard background and use MP4 for broad browser, social-card, and embed compatibility, even when the Element itself supports transparency. These explicit URLs are the publishing source of truth.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.diff --git a/.agents/skills/scaffold-element/SKILL.md b/.agents/skills/scaffold-element/SKILL.mdindex 1591fb3040..14c8495f18 100644--- a/.agents/skills/scaffold-element/SKILL.md+++ b/.agents/skills/scaffold-element/SKILL.md@@ -13,8 +13,10 @@ This skill owns the technical scaffolding workflow. Use the [`publish-element` sChoose 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+- Composition width, height, fps, and preview duration+- Installed Element duration, or `null` when it should adapt to the composition- Fixed Element width and height, or `null` for both so it inherits the composition dimensions+- Every external source dependency as `{name, version}`, using `null` when no exact version is required- Preview padding, which affects only the docs preview and not the Element bounds- A provisional poster frame- Explicit poster and video URLs using the flat asset convention:@@ -44,7 +46,7 @@ Follow the Element Guidelines for the component itself. When using Studio-editab## 3. Register the development composition-Import and register the component in `packages/docs/src/components/Elements/element-definitions.ts` using the planned preview metadata. Add the explicit `preview` object next to the render metadata, including `posterUrl` and `videoUrl`. The URLs in this object are the source of truth for publishing; do not add a helper that derives production URLs from the Element slug.+Import and register the component in `packages/docs/src/components/Elements/element-definitions.ts` using the planned preview metadata. Set `durationInFrames` to the duration used by both the preview and the `<Sequence>` installed into Studio. Declare every external source import in `dependencies` except `react`, `react-dom`, and `remotion`, which are provided by every Remotion project; use exact versions only when the Element requires one. Add the explicit `preview` object next to the render metadata, including `posterUrl` and `videoUrl`. The URLs in this object are the source of truth for publishing; do not add a helper that derives production URLs from the Element slug.Do not edit `packages/docs/src/remotion/Root.tsx`. It automatically creates a composition for every central definition using the same sizing and wrapper used by published Elements.diff --git a/packages/docs/elements-template/index.mdx b/packages/docs/elements-template/index.mdxindex 77c39acc28..81480971d1 100644--- a/packages/docs/elements-template/index.mdx+++ b/packages/docs/elements-template/index.mdx@@ -10,6 +10,7 @@ export const elementDefinition = {category: 'category',component: ElementComponent,contributors: [],+ dependencies: [],description: 'One short sentence explaining what this Element demonstrates and when to use it.',displayName: 'Element title',durationInFrames: 120,diff --git a/packages/docs/elements/guidelines.mdx b/packages/docs/elements/guidelines.mdxindex 28bde03d2b..db45337568 100644--- a/packages/docs/elements/guidelines.mdx+++ b/packages/docs/elements/guidelines.mdx@@ -24,7 +24,7 @@ An Element should demonstrate one visual idea, technique, or workflow. It shouldIf 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.+The Elements gallery provides preview dimensions, frame rate, and duration. The `durationInFrames` value is used both for the preview and for the `<Sequence>` inserted into Studio.## Make it portable@@ -37,12 +37,14 @@ An Element should work when it is dragged or copied into another project.- 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.+- Declare packages that Studio may need to install, but do not declare `react`, `react-dom`, or `remotion`; every Remotion project already provides them.+- Declare every external dependency in the central Element definition. Use an exact version only when a non-Remotion package requires one. Remotion packages use the project's installed Remotion version.## Design it for compositionAn 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.+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. Set both Element dimensions to `null` when it adapts to the composition.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.diff --git a/packages/docs/src/components/Elements/ElementPage.tsx b/packages/docs/src/components/Elements/ElementPage.tsxindex 6845939e4f..2e88ae4e2e 100644--- a/packages/docs/src/components/Elements/ElementPage.tsx+++ b/packages/docs/src/components/Elements/ElementPage.tsx@@ -235,11 +235,13 @@ export const ElementPage: React.FC<ElementPageProps> = ({<dt>Dimensions</dt><dd>{getElementDimensionsLabel(definition)}</dd></div>+ <div>+ <dt>Preview FPS</dt>+ <dd>{fps}</dd>+ </div><div><dt>Duration</dt>- <dd>- {`${durationInFrames} frames (${durationInFrames / fps}s)`}- </dd>+ <dd>{durationInFrames / fps}s</dd></div><div><dt>Dependencies</dt>