Skip to content

🎥 Make videos programmatically with React

Elements: Add starter template for publishing libraries

Igor Samokhovetsfa076eecb895
diff --git a/bun.lock b/bun.lock
index c6bbed24a1..dc42dd0105 100644
--- a/bun.lock
+++ b/bun.lock
@@ -2143,6 +2143,34 @@
"@remotion/compositor-win32-x64-msvc": "workspace:*",
},
},
+ "packages/template-element-library": {
+ "name": "template-element-library",
+ "dependencies": {
+ "@heroicons/react": "2.2.0",
+ "@remotion/cli": "workspace:*",
+ "@remotion/player": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
+ "isbot": "5.1.40",
+ "react": "19.2.7",
+ "react-dom": "19.2.7",
+ "react-router": "8.3.0",
+ "remotion": "workspace:*",
+ },
+ "devDependencies": {
+ "@react-router/dev": "8.3.0",
+ "@react-router/node": "8.3.0",
+ "@remotion/eslint-config-flat": "workspace:*",
+ "@tailwindcss/vite": "4.2.0",
+ "@types/node": "22.20.0",
+ "@types/react": "19.2.7",
+ "@types/react-dom": "19.2.3",
+ "eslint": "10.12.0",
+ "prettier": "3.8.1",
+ "tailwindcss": "4.2.0",
+ "typescript": "5.9.3",
+ "vite": "7.3.6",
+ },
+ },
"packages/template-helloworld": {
"name": "template-helloworld",
"version": "1.0.0",
@@ -3811,6 +3839,8 @@
"@happy-dom/global-registrator": ["@happy-dom/[email protected]", "", { "dependencies": { "happy-dom": "14.5.1" } }, "sha512-QjCEmZwTRpmHHRXvh58+gGW1R3C6Qpiy9dgEbCcPs3XedWEwpuJyr3y05IBauNLNE8KevHBGIvkZzxeTbBcCTg=="],
+ "@heroicons/react": ["@heroicons/[email protected]", "", { "peerDependencies": { "react": ">= 16 || ^19.0.0-rc" } }, "sha512-LMcepvRaS9LYHJGsF0zzmgKCUim/X3N/DQKc4jepAXJ7l8QxJ1PmxJzqplF2Z3FE4PqBAIGyJAQ/w4B5dsqbtQ=="],
+
"@hono/node-server": ["@hono/[email protected]", "", { "peerDependencies": { "hono": "^4" } }, "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw=="],
"@huggingface/jinja": ["@huggingface/[email protected]", "", {}, "sha512-SgS1D1bglQ94ceD4ZCL6eayUDy9uV1xuyk61OjgSxU5GJh7upqZCKII0JoTYMc6wWsg3JUgaPRX0ElQzXPk3Cw=="],
@@ -8617,6 +8647,8 @@
"template-electron": ["template-electron@workspace:packages/template-electron"],
+ "template-element-library": ["template-element-library@workspace:packages/template-element-library"],
+
"template-empty": ["template-empty@workspace:packages/template-blank"],
"template-helloworld": ["template-helloworld@workspace:packages/template-helloworld"],
@@ -12695,6 +12727,16 @@
"template-electron/vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A=="],
+ "template-element-library/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-QWlFW2wf3nTjC13/DqRnBpR4ZO36VJH/JVBkA/vcnmbTBNQIlnObqyqZE1tUR7+Ni23Lda8R1BxMfbXRpCUx5g=="],
+
+ "template-element-library/eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", "@eslint/plugin-kit": "^0.7.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "11.1.5 || >11.1.6 <12", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-npHjrHb2o4ehH3mE+YuxABR+0gyb0aVWCIolgJDArwCiHEIsonBm3ZKjel5b0U5+a+MbEvIyRCGCzD3eKKK2NA=="],
+
+ "template-element-library/isbot": ["[email protected]", "", {}, "sha512-yNeeynhhtIVRBk12tBV4eHNxwB42HzR4Q3Ea7vCOiJhImGaAIdIMrbJtacQlBizGLjUPw+akkFI5Dn9T70XoVQ=="],
+
+ "template-element-library/tailwindcss": ["[email protected]", "", {}, "sha512-yYzTZ4++b7fNYxFfpnberEEKu43w44aqDMNM9MHMmcKuCH7lL8jJ4yJ7LGHv7rSwiqM0nkiobF9I6cLlpS2P7Q=="],
+
+ "template-element-library/vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg=="],
+
"template-empty/eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", "@eslint/plugin-kit": "^0.7.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "11.1.5 || >11.1.6 <12", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-npHjrHb2o4ehH3mE+YuxABR+0gyb0aVWCIolgJDArwCiHEIsonBm3ZKjel5b0U5+a+MbEvIyRCGCzD3eKKK2NA=="],
"template-empty/react": ["[email protected]", "", {}, "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA=="],
@@ -18365,6 +18407,40 @@
"template-electron/vite/tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
+ "template-element-library/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
+
+ "template-element-library/eslint/@eslint-community/eslint-utils": ["@eslint-community/[email protected]", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg=="],
+
+ "template-element-library/eslint/@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
+
+ "template-element-library/eslint/@eslint/config-array": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^10.2.4" } }, "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA=="],
+
+ "template-element-library/eslint/@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="],
+
+ "template-element-library/eslint/@eslint/plugin-kit": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.2.1", "levn": "^0.4.1" } }, "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q=="],
+
+ "template-element-library/eslint/@types/estree": ["@types/[email protected]", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
+
+ "template-element-library/eslint/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
+
+ "template-element-library/eslint/debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
+
+ "template-element-library/eslint/eslint-scope": ["[email protected]", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ=="],
+
+ "template-element-library/eslint/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],
+
+ "template-element-library/eslint/espree": ["[email protected]", "", { "dependencies": { "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^5.0.1" } }, "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw=="],
+
+ "template-element-library/eslint/esquery": ["[email protected]", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="],
+
+ "template-element-library/eslint/file-entry-cache": ["[email protected]", "", { "dependencies": { "flat-cache": "^6.1.23" } }, "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q=="],
+
+ "template-element-library/eslint/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="],
+
+ "template-element-library/vite/picomatch": ["[email protected]", "", {}, "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A=="],
+
+ "template-element-library/vite/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-xdB1oSLHbz1vRWgCDalrCqEFTWzFlhqFC5tIHLMOSUIjhm3XXQ1qrFy8S/ESr1JYRRXqM3c1QFiMZUJdUTqyMQ=="],
+
"template-empty/eslint/@eslint-community/eslint-utils": ["@eslint-community/[email protected]", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg=="],
"template-empty/eslint/@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
@@ -25439,6 +25515,16 @@
"template-electron/vite/tinyglobby/picomatch": ["[email protected]", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
+ "template-element-library/eslint/@eslint-community/eslint-utils/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
+
+ "template-element-library/eslint/@eslint/config-array/@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="],
+
+ "template-element-library/eslint/espree/acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="],
+
+ "template-element-library/eslint/file-entry-cache/flat-cache": ["[email protected]", "", { "dependencies": { "cacheable": "^2.5.0", "flatted": "^3.4.2", "hookified": "^1.15.0" } }, "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA=="],
+
+ "template-element-library/eslint/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="],
+
"template-empty/eslint/@eslint-community/eslint-utils/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
"template-empty/eslint/@eslint/config-array/@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="],
@@ -29585,6 +29671,8 @@
"template-electron/eslint/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
+ "template-element-library/eslint/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
+
"template-empty/eslint/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
"template-helloworld/eslint/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
diff --git a/packages/create-video/src/pkg-managers.ts b/packages/create-video/src/pkg-managers.ts
index 0e8fc84a88..65bbecd348 100644
--- a/packages/create-video/src/pkg-managers.ts
+++ b/packages/create-video/src/pkg-managers.ts
@@ -179,7 +179,11 @@ export const getUpgradeCommand = (manager: PackageManager) => {
};
export const getDevCommand = (manager: PackageManager, template: Template) => {
- if (template.cliId === 'react-router' || template.cliId === 'next') {
+ if (
+ template.cliId === 'react-router' ||
+ template.cliId === 'element-library' ||
+ template.cliId === 'next'
+ ) {
return `${getRunCommand(manager)} dev`;
}
diff --git a/packages/create-video/src/templates.ts b/packages/create-video/src/templates.ts
index c3b69cd175..94e72f7a1c 100644
--- a/packages/create-video/src/templates.ts
+++ b/packages/create-video/src/templates.ts
@@ -28,6 +28,7 @@ export type Template = {
| 'blank'
| 'next'
| 'react-router'
+ | 'element-library'
| 'three'
| 'still'
| 'audiogram'
@@ -277,6 +278,30 @@ export const FEATURED_TEMPLATES: Template[] = [
contributedBy: null,
showStackblitz: true,
},
+ {
+ homePageLabel: 'Element Library',
+ shortName: 'Element Library',
+ org: 'remotion-dev',
+ repoName: 'template-element-library',
+ description: 'Build and publish your own Remotion Element library',
+ longerDescription:
+ 'A React Router and Tailwind CSS website with three editable Elements, a development Studio, and installation through the Studio Protocol. Deploy as a static site.',
+ promoBanner: {
+ width: 1200,
+ height: 800,
+ src: '/img/element-library-template.png',
+ },
+ cliId: 'element-library' as const,
+ type: 'image' as const,
+ defaultBranch: 'main',
+ featuredOnHomePage: null,
+ previewURL: null,
+ previewLabel: null,
+ templateInMonorepo: 'template-element-library',
+ allowEnableTailwind: false,
+ contributedBy: null,
+ showStackblitz: false,
+ },
{
homePageLabel: '3D',
shortName: 'React Three Fiber',
diff --git a/packages/docs/src/components/IconForTemplate.tsx b/packages/docs/src/components/IconForTemplate.tsx
index f016432013..d90b5776f8 100644
--- a/packages/docs/src/components/IconForTemplate.tsx
+++ b/packages/docs/src/components/IconForTemplate.tsx
@@ -53,6 +53,10 @@ export const IconForTemplate: React.FC<{
return <ElectronIcon style={{height: scale * 36}} />;
}
+ if (template.cliId === 'element-library') {
+ return <Cubes style={{height: scale * 36}} />;
+ }
+
if (template.cliId === 'three') {
return (
<Cubes
diff --git a/packages/docs/static/generated/template-element-library.png b/packages/docs/static/generated/template-element-library.png
new file mode 100644
index 0000000000..273a99c861
Binary files /dev/null and b/packages/docs/static/generated/template-element-library.png differ
diff --git a/packages/docs/static/img/element-library-template.png b/packages/docs/static/img/element-library-template.png
new file mode 100644
index 0000000000..66c2208891
Binary files /dev/null and b/packages/docs/static/img/element-library-template.png differ
diff --git a/packages/promo-pages/public/img/element-library-template.png b/packages/promo-pages/public/img/element-library-template.png
new file mode 100644
index 0000000000..66c2208891
Binary files /dev/null and b/packages/promo-pages/public/img/element-library-template.png differ
diff --git a/packages/promo-pages/src/components/homepage/IconForTemplate.tsx b/packages/promo-pages/src/components/homepage/IconForTemplate.tsx
index 23ca399a72..19cce7b969 100644
--- a/packages/promo-pages/src/components/homepage/IconForTemplate.tsx
+++ b/packages/promo-pages/src/components/homepage/IconForTemplate.tsx
@@ -45,6 +45,10 @@ export const IconForTemplate: React.FC<{
);
}
+ if (template.cliId === 'element-library') {
+ return <Cubes style={{height: scale * 36}} />;
+ }
+
if (template.cliId === 'three') {
return (
<Cubes
diff --git a/packages/template-element-library/.gitignore b/packages/template-element-library/.gitignore
new file mode 100644
index 0000000000..71196306e6
--- /dev/null
+++ b/packages/template-element-library/.gitignore
@@ -0,0 +1,6 @@
+node_modules/
+.react-router/
+build/
+out/
+.env
+.DS_Store
diff --git a/packages/template-element-library/.prettierignore b/packages/template-element-library/.prettierignore
new file mode 100644
index 0000000000..98d3757a10
--- /dev/null
+++ b/packages/template-element-library/.prettierignore
@@ -0,0 +1,3 @@
+.react-router/
+build/
+node_modules/
diff --git a/packages/template-element-library/.prettierrc b/packages/template-element-library/.prettierrc
new file mode 100644
index 0000000000..37d5071748
--- /dev/null
+++ b/packages/template-element-library/.prettierrc
@@ -0,0 +1,5 @@
+{
+ "useTabs": false,
+ "bracketSpacing": true,
+ "tabWidth": 2
+}
diff --git a/packages/template-element-library/README.md b/packages/template-element-library/README.md
new file mode 100644
index 0000000000..d3b325bcbb
--- /dev/null
+++ b/packages/template-element-library/README.md
@@ -0,0 +1,142 @@
+# Remotion Element Library
+
+A React Router + Tailwind CSS website for publishing your own Remotion Elements, with a local authoring Studio and three editable examples. The production website is a static site: no database, API server, or rendering service is needed.
+
+## Develop
+
+Install dependencies and start the website:
+
+```sh
+bun install
+bun run dev
+```
+
+Open the URL printed by React Router (normally `http://localhost:5173`). In another terminal, start the authoring Studio:
+
+```sh
+bun run remotion:studio
+```
+
+The Studio lists all three example compositions. The website and Studio import the same component implementations. Edit files in `elements/` to update both previews. The website uses Vite; Studio uses Remotion's bundler.
+
+With npm, use `npm install`, `npm run dev`, and `npx remotion studio` instead.
+
+## Project structure
+
+- `elements/<slug>/<slug>.tsx`: self-contained installable components, including their interactive schemas.
+- `elements/registry.ts`: catalog metadata, components, dependencies, preview settings, and initial props.
+- `remotion/`: preview stage and authoring Studio compositions.
+- `app/`: React Router pages and Tailwind-styled UI.
+- `lib/element-payload.ts`: raw source imports and validated Studio Protocol payloads.
+- `lib/library-config.ts`: library name, description, and catalog URL.
+
+The examples demonstrate different conventions:
+
+- **Animated title**: a centered, editable title with entrance and exit animations.
+- **Lower third**: separately editable name and role bars, adapted from the official Name Lower Third Element.
+- **Moving grid**: a full-composition loop, using `Interactive.create()` and color controls in the Inspector.
+
+The examples do not need external fonts, assets, or additional packages. The website loads Inter from its official CDN with a system-font fallback; this font is not installed with Elements.
+
+## Customize the website
+
+Change the identity in `lib/library-config.ts`. Change colors and fonts in `app/app.css`, and Tailwind utilities in the route and component files. Replace the example descriptions and usage notes in `elements/registry.ts`.
+
+The website registers its current origin by default, which works for localhost and deployment preview URLs. To always register the production catalog, set `libraryConfig.url` to your absolute HTTPS homepage URL, for example `https://elements.example.com/`. This template assumes deployment at the domain root.
+
+## Add an Element
+
+1. Create `elements/my-element/my-element.tsx`. Export exactly one named React component from this file. Keep all implementation code in that file; imports of sibling project files will not exist in the receiving project.
+2. Import the component into `elements/registry.ts` and add one entry with `slug: "my-element"`. Use a unique, lowercase, hyphenated slug.
+3. Set the description, usage notes, preview width/height, FPS, duration, and a representative `posterFrame` within that duration. The registry drives the gallery, detail page, and prerendered URL automatically. Add a matching preview composition in `remotion/Root.tsx` for local authoring.
+4. Declare every additional package in `dependencies`. Exclude `react`, `react-dom`, and `remotion`. Remotion packages use `version: null`; other packages need an exact version, not a range.
+5. Run `bun run lint` and `bun run build`. The website validates every payload with `createElementPayload()` during the build. Also install the Element into a clean project to check that it works independently.
+
+The site imports each component normally for its Player preview, then loads the **same file** with Vite's `?raw` support for installation. Do not create a second source-code copy. Keep Vite-specific source loading out of `remotion/` and the installable component files.
+
+### Layout and interactivity
+
+Use `installationMode: "wrapped"` for separately editable layers. Studio supplies the placement Sequence. Keep the Element's smallest useful bounding box in `dimensions`; the preview stage centers it without adding padding to the installed source.
+
+Use `installationMode: "component-owned-sequence"` for a single interactive object. Export the `Interactive.create()` result directly. Use `layout: "absolute-fill"` for backgrounds and `layout: "none"` for bounded objects. In the latter case, forward the `style` prop to the visual root. For backgrounds that adapt to their parent, set `dimensions: null`.
+
+Keep styles inline in installable source. Tailwind classes, website CSS, and preview backgrounds are not copied to the user's project. Temporary overlays should animate both in and out.
+
+Authoring compositions use explicit registrations and inline `defaultProps` so Studio can save edits. Keep their dimensions, FPS, and duration in sync with the registry. Edit the Element's individual source nodes in Studio or your editor. For a schema-enabled Element, you can also register the exported component directly as a connected composition.
+
+Read the [Element guidelines](https://www.remotion.dev/elements/guidelines) and [library integration guide](https://www.remotion.dev/docs/studio-protocol/component-library-integration).
+
+### Assets and initial props
+
+Use `initialProps` for ordinary preview values. For assets that should remain hosted, keep their absolute URL strings there.
+
+To copy an asset into the receiving project:
+
+1. Serve the file at a public HTTPS URL.
+2. Add an asset entry, for example `{type: "url", url: "https://elements.example.com/logo.png", path: "my-library/my-element/logo.png"}`.
+3. Keep the URL string in the corresponding preview prop.
+4. Use `staticFileRef("my-library/my-element/logo.png")` from `@remotion/studio-protocol` in `installationProps` for the corresponding installed prop.
+
+`installationProps` shallowly overrides `initialProps` only when creating the install payload. An overridden object or array replaces that entire prop. Never pass `staticFileRef()` objects to the Player. For component-owned Elements, do not put `from`, `durationInFrames`, or `name` in initial props; Studio supplies them.
+
+## Studio Protocol
+
+- **Add library to Studio** uses `addElementLibraryToStudio()` to request registration in the most recently focused compatible local Studio. The user confirms before Studio updates `remotion.config.ts`.
+- **Use** on gallery cards and **Use in Studio** on detail pages use `installInStudio()`. Card buttons appear on hover or keyboard focus and remain visible on touch devices. The user confirms the installation destination in Studio.
+- Dragging an Element card or its Use button uses `setStudioDragData()` with the same payload.
+- Embedded browsing uses `isInsideStudio()` to hide redundant chrome. Internal links preserve the Studio query parameters.
+- Failed requests open a standalone adaptation of the official library’s fallback: Studio setup links, retry, drag/copy-source alternatives for Elements, and manual URL registration for libraries. Guidance stays out of the gallery and does not resize the navbar.
+
+A successful response means the request reached Studio, not that the user accepted it. The UI intentionally says to confirm in Studio.
+
+The authoring Studio is for developing Elements. Verify distribution in a **separate clean Remotion project** with a composition and a `remotion.config.ts`. Focus that Studio immediately before installing, especially if several Studios are open. If no insertion destination is focused, drag the Element onto the composition or timeline instead.
+
+There is no catalog JSON API and no library npm package to install. The public website delivers component source and installation metadata. Treat all Element source as public.
+
+## Build and deploy
+
+```sh
+bun run lint
+bun run build
+bun run preview
+```
+
+Deploy `build/client/` to a static host. The build prerenders `/` and every registered `/elements/<slug>` page. Do not deploy `build/server/`; it is only used during prerendering.
+
+A `vercel.json` is included: use the repository root as the project root, install dependencies, and run `npm run build` (or `bun run build`). No environment variables or cloud credentials are required.
+
+For other hosts:
+
+- Serve directory `index.html` files for clean URLs, including `/elements/animated-title`.
+- If you enable an SPA fallback, use `__spa-fallback.html` for unknown paths, not the prerendered home page. Known Element paths should serve their own HTML. A host-level 404 is also acceptable for unknown URLs.
+- Use HTTPS. Studio Protocol supports HTTP only on `localhost` and `127.0.0.1`.
+- Allow the website to be embedded by local Studio origins. Do not send `X-Frame-Options: DENY` or `SAMEORIGIN`, or a restrictive CSP `frame-ancestors` policy that blocks Studio. Adjust your hosting provider's defaults if necessary.
+- Set the production catalog URL in `lib/library-config.ts` if you do not want preview deployments registered as separate libraries.
+
+Before publishing, verify direct navigation and refresh on each Element URL, library registration, iframe navigation, click installation, and cross-tab drag-and-drop from the HTTPS deployment. Check the installed source and compare its output with the Player preview.
+
+## Maintenance and versioning
+
+Elements are source-code copies, not managed dependencies. Updating this website does not update already installed Elements. Keep slugs stable, document breaking changes, and use Git tags/releases to record published versions. Users can reinstall and review changes themselves.
+
+Keep all Remotion packages on the same version. This template requires the release containing `Interactive.create()` (the upcoming 4.0.536 release); the published 4.0.535 packages do not provide it. Until that release, develop against the Remotion monorepo workspace packages. Publish this template only after the matching Remotion and ESLint configuration packages are released. The receiving project also needs a compatible Remotion version.
+
+Upgrade with:
+
+```sh
+bunx remotion upgrade
+```
+
+The npm equivalent is `npx remotion upgrade`.
+
+To export an example preview video locally:
+
+```sh
+bunx remotion render animated-title out/animated-title.mp4
+```
+
+The npm equivalent is `npx remotion render animated-title out/animated-title.mp4`.
+
+## License
+
+Remotion's [license terms](https://www.remotion.dev/license) apply. Set and document the license for the Elements you publish so users know how they may use and modify the source.
diff --git a/packages/template-element-library/app/app.css b/packages/template-element-library/app/app.css
new file mode 100644
index 0000000000..05c3ff1581
--- /dev/null
+++ b/packages/template-element-library/app/app.css
@@ -0,0 +1,29 @@
+@import url("https://rsms.me/inter/inter.css");
+@import "tailwindcss";
+
+@theme {
+ --font-sans: "InterVariable", Arial, sans-serif;
+ --font-sans--font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
+ --color-ink: #202020;
+ --color-muted: #636363;
+ --color-accent: #c34228;
+}
+
+@layer base {
+ body {
+ @apply m-0 bg-white font-sans text-ink;
+ }
+
+ button,
+ summary {
+ @apply cursor-pointer;
+ }
+
+ button:disabled {
+ @apply cursor-wait opacity-60;
+ }
+
+ :focus-visible {
+ @apply outline-2 outline-offset-4 outline-accent;
+ }
+}
diff --git a/packages/template-element-library/app/components/element-card.tsx b/packages/template-element-library/app/components/element-card.tsx
new file mode 100644
index 0000000000..36fa03bc82
--- /dev/null
+++ b/packages/template-element-library/app/components/element-card.tsx
@@ -0,0 +1,62 @@
+import { useState } from "react";
+import { Link, useOutletContext } from "react-router";
+import { setStudioDragData } from "@remotion/studio-protocol";
+import type { CatalogEntry } from "../../lib/element-payload";
+import { ElementPreview } from "./element-preview";
+import { StudioActions } from "./studio-actions";
+
+export const ElementCard = ({ entry }: { entry: CatalogEntry }) => {
+ const { definition } = entry;
+ const { search } = useOutletContext<{ search: string }>();
+ const [hovered, setHovered] = useState(false);
+ const [focused, setFocused] = useState(false);
+
+ return (
+ <li
+ className="group/card relative min-w-0"
+ onPointerEnter={(event) => {
+ if (event.pointerType !== "touch") setHovered(true);
+ }}
+ onPointerLeave={() => setHovered(false)}
+ onFocus={() => setFocused(true)}
+ onBlur={(event) => {
+ if (!event.currentTarget.contains(event.relatedTarget))
+ setFocused(false);
+ }}
+ >
+ <Link
+ className="grid gap-4 rounded-md"
+ to={{ pathname: `/elements/${definition.slug}`, search }}
+ draggable
+ onDragStart={(event) =>
+ setStudioDragData({
+ dataTransfer: event.dataTransfer,
+ payload: entry.payload,
+ })
+ }
+ >
+ <div
+ className="relative aspect-video overflow-hidden rounded-[min(1vw,8px)] bg-neutral-50 outline-1 -outline-offset-1 outline-black/5 [&>div]:pointer-events-none"
+ aria-hidden
+ >
+ <ElementPreview
+ definition={definition}
+ controls={false}
+ playing={hovered || focused}
+ />
+ </div>
+ <div>
+ <h2 className="text-lg font-medium text-balance sm:text-base">
+ {definition.displayName}
+ </h2>
+ <p className="mt-1.5 text-base/7 text-pretty text-muted sm:text-sm/6">
+ {definition.description}
+ </p>
+ </div>
+ </Link>
+ <div className="pointer-events-none absolute inset-x-0 top-0 flex aspect-video items-end justify-end p-3">
+ <StudioActions entry={entry} variant="card" />
+ </div>
+ </li>
+ );
+};
diff --git a/packages/template-element-library/app/components/element-preview.tsx b/packages/template-element-library/app/components/element-preview.tsx
new file mode 100644
index 0000000000..ca78822d4a
--- /dev/null
+++ b/packages/template-element-library/app/components/element-preview.tsx
@@ -0,0 +1,63 @@
+import { Player, type PlayerRef } from "@remotion/player";
+import { useEffect, useMemo, useRef, type CSSProperties } from "react";
+import type { ElementDefinition } from "../../elements/registry";
+import { ElementPreview as PreviewComposition } from "../../remotion/ElementPreview";
+
+export const ElementPreview = ({
+ definition,
+ controls,
+ playing,
+}: {
+ definition: ElementDefinition;
+ controls: boolean;
+ playing: boolean;
+}) => {
+ const player = useRef<PlayerRef>(null);
+ const inputProps = useMemo(
+ () => ({ slug: definition.slug }),
+ [definition.slug],
+ );
+
+ useEffect(() => {
+ if (controls) return;
+ const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
+ const update = () => {
+ if (playing && !preference.matches) {
+ player.current?.seekTo(0);
+ player.current?.play();
+ } else {
+ player.current?.pause();
+ player.current?.seekTo(definition.posterFrame);
+ }
+ };
+ update();
+ preference.addEventListener("change", update);
+ return () => preference.removeEventListener("change", update);
+ }, [controls, playing, definition.posterFrame]);
+
+ return (
+ <Player
+ ref={player}
+ component={PreviewComposition}
+ inputProps={inputProps}
+ compositionWidth={definition.width}
+ compositionHeight={definition.height}
+ durationInFrames={definition.durationInFrames}
+ fps={definition.fps}
+ initialFrame={definition.posterFrame}
+ controls={controls}
+ clickToPlay={controls}
+ doubleClickToFullscreen={controls}
+ spaceKeyToPlayOrPause={controls}
+ loop
+ className="bg-(--preview-background)"
+ // Player reads style.width to calculate the composition's preview scale.
+ style={
+ {
+ width: "100%",
+ "--preview-background": definition.previewBackground,
+ } as CSSProperties
+ }
+ />
+ );
+};
diff --git a/packages/template-element-library/app/components/studio-actions.tsx b/packages/template-element-library/app/components/studio-actions.tsx
new file mode 100644
index 0000000000..a5797a9ede
--- /dev/null
+++ b/packages/template-element-library/app/components/studio-actions.tsx
@@ -0,0 +1,191 @@
+import {
+ addElementLibraryToStudio,
+ installInStudio,
+ setStudioDragData,
+} from "@remotion/studio-protocol";
+import {
+ ArrowUpRightIcon,
+ PlusIcon,
+ XMarkIcon,
+} from "@heroicons/react/16/solid";
+import { useRef, useState } from "react";
+import type { CatalogEntry } from "../../lib/element-payload";
+import { libraryConfig } from "../../lib/library-config";
+import {
+ StudioInstallFallback,
+ type StudioFailure,
+} from "./studio-install-fallback";
+
+type Status =
+ | { type: "idle" | "pending" | "success"; message: string }
+ | ({ type: "error" } & StudioFailure);
+
+export const StudioActions = ({
+ entry,
+ variant,
+}:
+ | {
+ entry: CatalogEntry;
+ variant: "card";
+ }
+ | {
+ entry: CatalogEntry | null;
+ variant: "default";
+ }) => {
+ const [status, setStatus] = useState<Status>({ type: "idle", message: "" });
+ const [fallback, setFallback] = useState({ isOpen: false, failureCount: 0 });
+ const triggerRef = useRef<HTMLButtonElement>(null);
+
+ const sendToStudio = async () => {
+ setStatus({ type: "pending", message: "Finding Remotion Studio…" });
+ try {
+ const result = entry
+ ? await installInStudio({ payload: entry.payload })
+ : await addElementLibraryToStudio({
+ url: libraryConfig.url ?? new URL("/", window.location.origin).href,
+ displayName: libraryConfig.name,
+ });
+
+ if (result.success) {
+ setStatus({
+ type: "success",
+ message: "Request sent. Confirm in Remotion Studio to finish.",
+ });
+ setFallback({ isOpen: false, failureCount: 0 });
+ return;
+ }
+ setStatus({ type: "error", code: result.code, message: result.message });
+ } catch {
+ setStatus({
+ type: "error",
+ code: null,
+ message:
+ "Could not connect to Remotion Studio. Check that Studio is running, then try again.",
+ });
+ }
+ setFallback((previous) => ({
+ isOpen: true,
+ failureCount: previous.failureCount + 1,
+ }));
+ };
+
+ return (
+ <div className="min-w-0">
+ <button
+ ref={triggerRef}
+ className={
+ variant === "card"
+ ? "pointer-events-auto relative inline-flex h-7.5 w-16 items-center justify-center rounded-md bg-white px-2.5 text-base font-medium text-ink shadow-sm ring-1 ring-black/10 hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent aria-busy:pointer-events-auto aria-busy:opacity-100 pointer-fine:pointer-events-none pointer-fine:opacity-0 pointer-fine:group-hover/card:pointer-events-auto pointer-fine:group-hover/card:opacity-100 pointer-fine:group-focus-within/card:pointer-events-auto pointer-fine:group-focus-within/card:opacity-100 sm:text-sm"
+ : "relative inline-flex h-9 items-center justify-center gap-2 rounded-md bg-ink py-2 pr-3 pl-2 text-base font-medium text-white hover:bg-neutral-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent sm:text-sm"
+ }
+ aria-label={
+ variant === "card"
+ ? status.type === "pending"
+ ? `Sending ${entry.definition.displayName} to Studio`
+ : status.type === "success"
+ ? `Sent ${entry.definition.displayName} to Studio`
+ : `Use ${entry.definition.displayName} in Studio`
+ : undefined
+ }
+ title={
+ variant === "card" && status.type === "success"
+ ? status.message
+ : undefined
+ }
+ type="button"
+ disabled={status.type === "pending"}
+ aria-busy={status.type === "pending"}
+ draggable={entry !== null}
+ onClick={sendToStudio}
+ onDragStart={(event) => {
+ if (!entry) return;
+ setStudioDragData({
+ dataTransfer: event.dataTransfer,
+ payload: entry.payload,
+ });
+ }}
+ >
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ {variant === "default" &&
+ (entry ? (
+ <ArrowUpRightIcon className="size-4 shrink-0 fill-white" />
+ ) : (
+ <PlusIcon className="size-4 shrink-0 fill-white" />
+ ))}
+ <span className="relative">
+ <span
+ className={status.type === "pending" ? "invisible" : undefined}
+ aria-hidden={status.type === "pending"}
+ >
+ {variant === "card"
+ ? status.type === "success"
+ ? "Sent"
+ : "Use"
+ : entry
+ ? "Use in Studio"
+ : "Add library to Studio"}
+ </span>
+ {status.type === "pending" && (
+ <span className="absolute inset-0">
+ {variant === "card" ? "…" : "Connecting…"}
+ </span>
+ )}
+ </span>
+ </button>
+ {entry && variant === "default" && (
+ <p className="mt-3 text-base/7 text-pretty text-muted sm:text-sm/6">
+ Or drag into your composition.
+ </p>
+ )}
+ <div
+ aria-live="polite"
+ aria-atomic="true"
+ className={
+ variant === "card"
+ ? "sr-only"
+ : "fixed inset-x-4 bottom-4 z-50 text-base/7 sm:right-6 sm:bottom-6 sm:left-auto sm:w-96 sm:text-sm/6"
+ }
+ >
+ {!fallback.isOpen && status.type !== "error" && status.message && (
+ <div className="flex items-start gap-3 rounded-lg bg-white p-4 shadow-lg ring-1 ring-black/10">
+ <div className="min-w-0 flex-1 text-pretty wrap-anywhere">
+ <p>{status.message}</p>
+ </div>
+ {status.type !== "pending" && variant === "default" && (
+ <button
+ type="button"
+ aria-label="Dismiss notification"
+ className="relative flex size-7.5 shrink-0 items-center justify-center rounded-md hover:bg-neutral-100"
+ onClick={() => setStatus({ type: "idle", message: "" })}
+ >
+ <XMarkIcon className="size-4 shrink-0 fill-muted" />
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ </button>
+ )}
+ </div>
+ )}
+ </div>
+ {fallback.isOpen && (
+ <StudioInstallFallback
+ entry={entry}
+ failure={status.type === "error" ? status : null}
+ failureCount={fallback.failureCount}
+ isPending={status.type === "pending"}
+ onRetry={sendToStudio}
+ onClose={() => {
+ setFallback({ isOpen: false, failureCount: 0 });
+ if (status.type === "error")
+ setStatus({ type: "idle", message: "" });
+ }}
+ triggerRef={triggerRef}
+ />
+ )}
+ </div>
+ );
+};
diff --git a/packages/template-element-library/app/components/studio-install-fallback.tsx b/packages/template-element-library/app/components/studio-install-fallback.tsx
new file mode 100644
index 0000000000..e399c8a468
--- /dev/null
+++ b/packages/template-element-library/app/components/studio-install-fallback.tsx
@@ -0,0 +1,328 @@
+import { XMarkIcon } from "@heroicons/react/16/solid";
+import {
+ setStudioDragData,
+ type AddElementLibraryToStudioErrorCode,
+ type InstallInStudioErrorCode,
+} from "@remotion/studio-protocol";
+import { useEffect, useId, useRef, useState, type RefObject } from "react";
+import { createPortal } from "react-dom";
+import type { CatalogEntry } from "../../lib/element-payload";
+import { libraryConfig } from "../../lib/library-config";
+
+export type StudioFailure = {
+ code: AddElementLibraryToStudioErrorCode | InstallInStudioErrorCode | null;
+ message: string;
+};
+
+// Standalone adaptation of the official Elements library's installation fallback.
+// Mounted only after a failed request; no browser APIs run during prerendering.
+export const StudioInstallFallback = ({
+ entry,
+ failure,
+ failureCount,
+ isPending,
+ onRetry,
+ onClose,
+ triggerRef,
+}: {
+ entry: CatalogEntry | null;
+ failure: StudioFailure | null;
+ failureCount: number;
+ isPending: boolean;
+ onRetry: () => void;
+ onClose: () => void;
+ triggerRef: RefObject<HTMLButtonElement | null>;
+}) => {
+ const dialogRef = useRef<HTMLDialogElement>(null);
+ const titleId = useId();
+ const [copyStatus, setCopyStatus] = useState("");
+ const libraryUrl =
+ libraryConfig.url ?? new URL("/", window.location.origin).href;
+
+ useEffect(() => {
+ const dialog = dialogRef.current;
+ const trigger = triggerRef.current;
+ if (!dialog) return;
+ dialog.showModal();
+ return () => {
+ dialog.close();
+ window.requestAnimationFrame(() => {
+ if (trigger?.isConnected && !dialog.open) trigger.focus();
+ });
+ };
+ }, [triggerRef]);
+
+ useEffect(() => {
+ if (copyStatus !== "Copied.") return;
+ const timeout = window.setTimeout(() => setCopyStatus(""), 2000);
+ return () => window.clearTimeout(timeout);
+ }, [copyStatus]);
+
+ return createPortal(
+ <dialog
+ ref={dialogRef}
+ aria-labelledby={titleId}
+ className="m-auto max-h-[calc(100dvh_-_--spacing(8))] w-[calc(100%_-_--spacing(8))] max-w-lg overflow-y-auto rounded-xl bg-white p-6 text-base/7 text-ink shadow-xl ring-1 ring-black/10 backdrop:bg-black/30 sm:text-sm/6"
+ onCancel={(event) => {
+ event.preventDefault();
+ onClose();
+ }}
+ onClick={(event) => {
+ if (event.target !== event.currentTarget) return;
+ const bounds = event.currentTarget.getBoundingClientRect();
+ if (
+ event.clientX < bounds.left ||
+ event.clientX > bounds.right ||
+ event.clientY < bounds.top ||
+ event.clientY > bounds.bottom
+ )
+ onClose();
+ }}
+ >
+ <div className="flex items-start justify-between gap-4">
+ <h2 id={titleId} className="min-w-0 text-xl font-semibold text-balance">
+ {entry ? "Use this Element" : `Add ${libraryConfig.name} to Studio`}
+ </h2>
+ <button
+ type="button"
+ aria-label="Close installation help"
+ className="relative flex size-7.5 shrink-0 items-center justify-center rounded-md hover:bg-neutral-100"
+ onClick={onClose}
+ >
+ <XMarkIcon className="size-4 shrink-0 fill-muted" />
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ </button>
+ </div>
+ <div
+ aria-live="polite"
+ className="mt-4 text-pretty wrap-anywhere text-muted [&_a]:underline [&_a]:underline-offset-4"
+ >
+ {isPending ? (
+ <p>Finding a compatible Remotion Studio…</p>
+ ) : failure?.code === "no-compatible-studio" ? (
+ <p>
+ Remotion Studio is the video editor for your Remotion project. Open
+ an existing project or{" "}
+ <a
+ href="https://www.remotion.dev/docs/"
+ target="_blank"
+ rel="noreferrer"
+ >
+ create your first Remotion project
+ </a>
+ , and{" "}
+ <a
+ href="https://www.remotion.dev/docs/studio"
+ target="_blank"
+ rel="noreferrer"
+ >
+ install and open Remotion Studio
+ </a>
+ . Once Studio is running, return here and try again.
+ </p>
+ ) : failure?.code === "no-installable-target" ? (
+ <p>
+ Open your video in{" "}
+ <a
+ href="https://www.remotion.dev/docs/studio"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Remotion Studio
+ </a>
+ , select where you want to insert the Element, then try again.{" "}
+ <a
+ href="https://www.remotion.dev/docs/studio/browse-elements"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Learn how to add Elements to your video.
+ </a>
+ </p>
+ ) : failure?.code === "no-configurable-target" ? (
+ <p>
+ <a
+ href="https://www.remotion.dev/docs/studio"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Open Remotion Studio
+ </a>{" "}
+ for your local project and switch to its browser tab, then try
+ again.
+ </p>
+ ) : failure?.code === "studio-upgrade-required" ? (
+ <p>
+ {failure.message}{" "}
+ <a
+ href="https://www.remotion.dev/docs/upgrading"
+ target="_blank"
+ rel="noreferrer"
+ >
+ How to upgrade Remotion.
+ </a>
+ </p>
+ ) : (
+ <p>{failure?.message}</p>
+ )}
+ </div>
+ <button
+ type="button"
+ disabled={isPending}
+ aria-busy={isPending}
+ draggable={entry !== null && !isPending}
+ onDragStart={(event) => {
+ if (entry)
+ setStudioDragData({
+ dataTransfer: event.dataTransfer,
+ payload: entry.payload,
+ });
+ }}
+ onClick={onRetry}
+ className="relative mt-5 inline-flex h-9 items-center justify-center rounded-md bg-ink px-3 text-base font-medium text-white hover:bg-neutral-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent sm:text-sm"
+ >
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ {isPending ? "Connecting…" : "Try again"}
+ </button>
+ {entry ? (
+ <>
+ <p className="mt-4 text-pretty text-muted">
+ {failureCount > 1
+ ? "Still not connecting? Drag the button above into your Studio instead."
+ : "You can also drag the button above into your Studio."}
+ </p>
+ <p className="mt-4 text-pretty text-muted">
+ Or copy the source code and create a new TSX file in your project.
+ </p>
+ <button
+ type="button"
+ className="relative mt-3 inline-flex h-9 items-center rounded-md border border-neutral-950/15 px-3 font-medium hover:bg-neutral-50"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(entry.sourceCode);
+ setCopyStatus("Copied.");
+ } catch {
+ setCopyStatus(
+ "Could not copy. Open the Element’s page and select the code under View source.",
+ );
+ }
+ }}
+ >
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ Copy source
+ </button>
+ </>
+ ) : (
+ <div className="mt-6 border-t border-neutral-950/10 pt-5">
+ <h3 className="text-base font-medium text-balance sm:text-sm">
+ Add manually
+ </h3>
+ <p className="mt-2 text-pretty text-muted">
+ In your local Studio, open{" "}
+ <strong className="font-medium text-ink">Settings</strong>, select{" "}
+ <strong className="font-medium text-ink">Elements</strong>, then
+ choose <strong className="font-medium text-ink">Add by URL</strong>{" "}
+ and paste this URL:
+ </p>
+ <div className="mt-3 flex flex-col items-start gap-3 sm:flex-row sm:items-center">
+ <input
+ type="text"
+ name="library-url"
+ aria-label="Library URL"
+ readOnly
+ value={libraryUrl}
+ onFocus={(event) => event.currentTarget.select()}
+ className="w-full min-w-0 rounded-md border border-neutral-950/15 px-3 py-2 font-mono focus-visible:-outline-offset-1 sm:flex-1"
+ />
+ <button
+ type="button"
+ className="relative inline-flex h-9 shrink-0 items-center rounded-md border border-neutral-950/15 px-3 font-medium hover:bg-neutral-50"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(libraryUrl);
+ setCopyStatus("Copied.");
+ } catch {
+ setCopyStatus(
+ "Could not copy. Select the URL above and copy it manually.",
+ );
+ }
+ }}
+ >
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ Copy URL
+ </button>
+ </div>
+ <p className="mt-3 text-pretty text-muted">
+ Then click{" "}
+ <strong className="font-medium text-ink">
+ + Add Element Library
+ </strong>{" "}
+ in Studio.
+ </p>
+ <p className="mt-3 text-pretty text-muted">
+ You can also add this URL to <code>remotion.config.ts</code> using{" "}
+ <a
+ className="underline underline-offset-4"
+ href="https://www.remotion.dev/docs/config#addelementlibrary"
+ target="_blank"
+ rel="noreferrer"
+ >
+ <code>Config.addElementLibrary()</code>
+ </a>
+ .
+ </p>
+ </div>
+ )}
+ <p
+ role="status"
+ className="mt-3 text-pretty wrap-anywhere text-muted empty:hidden"
+ >
+ {copyStatus}
+ </p>
+ <nav
+ aria-label="Remotion Studio guides"
+ className="mt-6 border-t border-neutral-950/10 pt-5"
+ >
+ <h3 className="text-base font-medium text-balance sm:text-sm">
+ Learn Remotion Studio
+ </h3>
+ <ul
+ role="list"
+ className="mt-2 space-y-2 text-muted [&_a]:underline [&_a]:underline-offset-4 [&_a:hover]:text-ink"
+ >
+ <li>
+ <a
+ href="https://www.remotion.dev/docs/studio/browse-elements"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Browse Elements and add libraries
+ </a>
+ </li>
+ <li>
+ <a
+ href="https://www.remotion.dev/docs/studio/interactivity"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Edit Elements in the preview and timeline
+ </a>
+ </li>
+ </ul>
+ </nav>
+ </dialog>,
+ document.body,
+ );
+};
diff --git a/packages/template-element-library/app/root.tsx b/packages/template-element-library/app/root.tsx
new file mode 100644
index 0000000000..3ed518996b
--- /dev/null
+++ b/packages/template-element-library/app/root.tsx
@@ -0,0 +1,111 @@
+import { isInsideStudio } from "@remotion/studio-protocol";
+import { useEffect, useState, type ReactNode } from "react";
+import {
+ isRouteErrorResponse,
+ Link,
+ Links,
+ Meta,
+ Outlet,
+ Scripts,
+ ScrollRestoration,
+ useLocation,
+ useRouteError,
+} from "react-router";
+import { libraryConfig } from "../lib/library-config";
+import { StudioActions } from "./components/studio-actions";
+import "./app.css";
+
+export function Layout({ children }: { children: ReactNode }) {
+ return (
+ <html lang="en" className="antialiased">
+ <head>
+ <meta charSet="utf-8" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <Meta />
+ <Links />
+ </head>
+ <body>
+ {children}
+ <ScrollRestoration />
+ <Scripts />
+ </body>
+ </html>
+ );
+}
+
+export default function App() {
+ const [insideStudio, setInsideStudio] = useState(false);
+ const [hydrated, setHydrated] = useState(false);
+ const location = useLocation();
+ // Prerendered HTML has no query string. Add Studio context to links only
+ // after hydration, then preserve it on every client-side navigation.
+ const search = hydrated ? location.search : "";
+ useEffect(() => {
+ setInsideStudio(isInsideStudio());
+ setHydrated(true);
+ }, []);
+
+ return (
+ <div
+ data-embedded={insideStudio}
+ className="group/site isolate flex min-h-dvh flex-col"
+ >
+ <a
+ className="absolute -top-24 left-6 z-50 bg-white p-3 focus:top-3"
+ href="#main"
+ >
+ Skip to content
+ </a>
+ {!insideStudio && (
+ <header className="border-b border-neutral-950/10">
+ <div className="mx-auto flex min-h-18 max-w-7xl flex-wrap items-center justify-between gap-x-6 gap-y-3 px-6 py-4 sm:px-8 lg:px-12">
+ <div className="min-w-0 shrink-0 grow text-lg font-semibold tracking-tight">
+ <Link
+ className="inline-flex items-center gap-2.5"
+ aria-label="Homepage"
+ to={{ pathname: "/", search }}
+ >
+ <img src="/favicon.svg" alt="" className="size-6 shrink-0" />
+ {libraryConfig.name}
+ </Link>
+ </div>
+ {location.pathname === "/" && (
+ <div className="w-full min-w-0 sm:w-auto sm:max-w-80">
+ <StudioActions entry={null} variant="default" />
+ </div>
+ )}
+ </div>
+ </header>
+ )}
+ <div className="mx-auto w-full max-w-7xl flex-1 px-6 sm:px-8 lg:px-12">
+ <Outlet context={{ insideStudio, search }} />
+ </div>
+ </div>
+ );
+}
+
+export function ErrorBoundary() {
+ const error = useRouteError();
+ const notFound = isRouteErrorResponse(error) && error.status === 404;
+ return (
+ <main
+ id="main"
+ className="isolate mx-auto max-w-7xl px-6 py-20 sm:px-8 lg:px-12"
+ >
+ <h1 className="text-3xl font-semibold tracking-tight text-balance">
+ {notFound ? "Page not found" : "The library couldn’t load"}
+ </h1>
+ <p className="mt-4 text-base text-pretty text-muted">
+ {notFound
+ ? "Choose an Element from the library."
+ : "Reload the page and try again."}
+ </p>
+ <p className="mt-6 text-base sm:text-sm">
+ <Link className="underline underline-offset-4 hover:text-accent" to="/">
+ Back to the library
+ </Link>
+ </p>
+ </main>
+ );
+}
diff --git a/packages/template-element-library/app/routes.ts b/packages/template-element-library/app/routes.ts
new file mode 100644
index 0000000000..2d14587a5d
--- /dev/null
+++ b/packages/template-element-library/app/routes.ts
@@ -0,0 +1,6 @@
+import { index, route, type RouteConfig } from "@react-router/dev/routes";
+
+export default [
+ index("routes/library.tsx"),
+ route("elements/:slug", "routes/element.tsx"),
+] satisfies RouteConfig;
diff --git a/packages/template-element-library/app/routes/element.tsx b/packages/template-element-library/app/routes/element.tsx
new file mode 100644
index 0000000000..7556d2afad
--- /dev/null
+++ b/packages/template-element-library/app/routes/element.tsx
@@ -0,0 +1,164 @@
+import { ArrowLeftIcon, ChevronDownIcon } from "@heroicons/react/16/solid";
+import { useState } from "react";
+import {
+ Link,
+ useOutletContext,
+ useParams,
+ type MetaFunction,
+} from "react-router";
+import { catalog } from "../../lib/element-payload";
+import { libraryConfig } from "../../lib/library-config";
+import { ElementPreview } from "../components/element-preview";
+import { StudioActions } from "../components/studio-actions";
+
+export const meta: MetaFunction = ({ params }) => {
+ const entry = catalog.find(
+ ({ definition }) => definition.slug === params.slug,
+ );
+ return [
+ {
+ title: `${entry?.definition.displayName ?? "Element not found"} — ${libraryConfig.name}`,
+ },
+ {
+ name: "description",
+ content: entry?.definition.description ?? "Browse the Element library.",
+ },
+ ];
+};
+
+export default function ElementPage() {
+ const { slug } = useParams();
+ const { search } = useOutletContext<{ search: string }>();
+ const [copyStatus, setCopyStatus] = useState("");
+ const entry = catalog.find(({ definition }) => definition.slug === slug);
+ if (!entry) {
+ return (
+ <main id="main" className="py-16">
+ <h1 className="text-3xl font-semibold tracking-tight text-balance">
+ Element not found
+ </h1>
+ <p className="mt-4 text-base text-pretty text-muted">
+ Choose another Element from the library.
+ </p>
+ <p className="mt-6 text-base sm:text-sm">
+ <Link
+ className="underline underline-offset-4 hover:text-accent"
+ to={{ pathname: "/", search }}
+ >
+ Back to the library
+ </Link>
+ </p>
+ </main>
+ );
+ }
+ const { definition, sourceCode } = entry;
+
+ return (
+ <main id="main" className="min-w-0 pt-8 pb-12">
+ <div className="text-base sm:text-sm">
+ <Link
+ className="inline-flex min-h-12 items-center gap-2 text-muted hover:text-ink sm:min-h-9"
+ to={{ pathname: "/", search }}
+ >
+ <ArrowLeftIcon className="size-4 shrink-0 fill-current" /> All
+ elements
+ </Link>
+ </div>
+ <div className="pt-6 pb-8">
+ <h1 className="text-3xl font-semibold tracking-tight text-balance sm:text-4xl">
+ {definition.displayName}
+ </h1>
+ <p className="mt-3 max-w-[56ch] text-base text-pretty text-muted">
+ {definition.description}
+ </p>
+ </div>
+ <div className="grid grid-cols-1 items-start gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]">
+ <div className="min-w-0 overflow-hidden rounded-[min(1vw,8px)] outline-1 -outline-offset-1 outline-black/5">
+ <ElementPreview
+ key={slug}
+ definition={definition}
+ controls
+ playing={false}
+ />
+ </div>
+ <aside aria-label="Element details" className="min-w-0">
+ <h2 className="text-base font-medium text-balance sm:text-sm">
+ About this Element
+ </h2>
+ <p className="mt-3 text-base/7 text-pretty text-muted sm:text-sm/6">
+ {definition.usage}
+ </p>
+ <dl className="my-6 divide-y divide-neutral-950/10 text-base sm:text-sm [&>div]:flex [&>div]:justify-between [&>div]:gap-4 [&>div]:py-3 [&>div:first-child]:pt-0 [&>div:last-child]:pb-0 [&_dt]:font-medium [&_dd]:text-right [&_dd]:text-muted">
+ <div>
+ <dt>Category</dt>
+ <dd>{definition.category}</dd>
+ </div>
+ <div>
+ <dt>Duration</dt>
+ <dd className="tabular-nums">
+ {definition.durationInFrames / definition.fps}s ·{" "}
+ {definition.fps} fps
+ </dd>
+ </div>
+ <div>
+ <dt>Dimensions</dt>
+ <dd className="tabular-nums">
+ {definition.dimensions
+ ? `${definition.dimensions.width} × ${definition.dimensions.height}`
+ : "Fills composition"}
+ </dd>
+ </div>
+ </dl>
+ <StudioActions key={slug} entry={entry} variant="default" />
+ </aside>
+ </div>
+ <details
+ key={slug}
+ className="group/source mt-10 min-w-0 border-y border-neutral-950/10"
+ >
+ <summary className="flex min-h-14 list-none items-center justify-between gap-4 py-4 text-base font-medium hover:text-accent sm:text-sm [&::-webkit-details-marker]:hidden">
+ View source
+ <ChevronDownIcon className="size-4 shrink-0 fill-current group-open/source:rotate-180" />
+ </summary>
+ <div className="flex flex-wrap items-center justify-between gap-4 border-t border-neutral-950/10 py-4 text-base sm:text-sm">
+ <p className="min-w-0 break-all font-mono text-muted">
+ {definition.slug}.tsx
+ </p>
+ <button
+ className="relative inline-flex h-9 shrink-0 items-center rounded-md border border-neutral-950/15 px-3 font-medium hover:bg-neutral-50"
+ type="button"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(sourceCode);
+ setCopyStatus("Source copied.");
+ } catch {
+ setCopyStatus(
+ "Could not copy. Select and copy the source below.",
+ );
+ }
+ }}
+ >
+ <span
+ aria-hidden
+ className="pointer-fine:hidden absolute top-1/2 left-1/2 size-[max(100%,3rem)] -translate-1/2"
+ />
+ Copy source
+ </button>
+ <p
+ role="status"
+ className="w-full text-pretty text-muted empty:hidden"
+ >
+ {copyStatus}
+ </p>
+ </div>
+ <pre
+ tabIndex={0}
+ aria-label="Element source code"
+ className="mb-4 max-h-140 overflow-auto rounded-md bg-neutral-950 p-5 text-base/7 text-neutral-100 sm:text-sm/6"
+ >
+ <code>{sourceCode}</code>
+ </pre>
+ </details>
+ </main>
+ );
+}
diff --git a/packages/template-element-library/app/routes/library.tsx b/packages/template-element-library/app/routes/library.tsx
new file mode 100644
index 0000000000..81851db751
--- /dev/null
+++ b/packages/template-element-library/app/routes/library.tsx
@@ -0,0 +1,61 @@
+import { useState } from "react";
+import type { MetaFunction } from "react-router";
+import { catalog } from "../../lib/element-payload";
+import { libraryConfig } from "../../lib/library-config";
+import { ElementCard } from "../components/element-card";
+
+export const meta: MetaFunction = () => [
+ { title: `${libraryConfig.name} — Remotion Elements` },
+ { name: "description", content: libraryConfig.description },
+];
+
+export default function Library() {
+ const [category, setCategory] = useState<string | null>(null);
+ const categories = [
+ ...new Set(catalog.map(({ definition }) => definition.category)),
+ ];
+ const visible = catalog.filter(
+ ({ definition }) => category === null || definition.category === category,
+ );
+
+ return (
+ <main id="main" className="pt-6 pb-12">
+ <h1 className="sr-only">Elements</h1>
+ <section aria-label="Elements">
+ <div className="flex min-w-0 items-center justify-between gap-6 border-b border-neutral-950/10">
+ <div
+ className="flex min-w-0 gap-6 overflow-x-auto"
+ role="group"
+ aria-label="Filter by category"
+ >
+ {[null, ...categories].map((item) => (
+ <button
+ key={item ?? "all"}
+ type="button"
+ className="shrink-0 border-b-2 border-transparent py-4 text-base font-medium whitespace-nowrap text-muted hover:text-ink focus-visible:-outline-offset-4 aria-pressed:border-ink aria-pressed:text-ink sm:text-sm"
+ aria-pressed={category === item}
+ onClick={() => setCategory(item)}
+ >
+ {item ?? "All"}
+ </button>
+ ))}
+ </div>
+ <p
+ role="status"
+ className="shrink-0 text-sm whitespace-nowrap text-muted tabular-nums max-sm:sr-only"
+ >
+ {visible.length} {visible.length === 1 ? "element" : "elements"}
+ </p>
+ </div>
+ <ul
+ role="list"
+ className="grid grid-cols-1 gap-x-6 gap-y-10 pt-6 sm:grid-cols-2 lg:grid-cols-3"
+ >
+ {visible.map((entry) => (
+ <ElementCard key={entry.definition.slug} entry={entry} />
+ ))}
+ </ul>
+ </section>
+ </main>
+ );
+}
diff --git a/packages/template-element-library/elements/animated-background/animated-background.tsx b/packages/template-element-library/elements/animated-background/animated-background.tsx
new file mode 100644
index 0000000000..f21dfcf673
--- /dev/null
+++ b/packages/template-element-library/elements/animated-background/animated-background.tsx
@@ -0,0 +1,42 @@
+import { Interactive, useCurrentFrame, useVideoConfig } from "remotion";
+
+type AnimatedBackgroundProps = {
+ color?: string;
+ backgroundColor?: string;
+};
+
+const AnimatedBackgroundInner = ({
+ color = "#e3a253",
+ backgroundColor = "#fff2dd",
+}: AnimatedBackgroundProps) => {
+ const frame = useCurrentFrame();
+ const { durationInFrames } = useVideoConfig();
+
+ return (
+ <div
+ style={{
+ width: "100%",
+ height: "100%",
+ backgroundColor,
+ backgroundImage: `linear-gradient(${color} 4px, transparent 4px), linear-gradient(90deg, ${color} 4px, transparent 4px)`,
+ backgroundSize: "120px 120px",
+ backgroundPosition: `${(frame / durationInFrames) * 120}px ${(frame / durationInFrames) * 120}px`,
+ }}
+ />
+ );
+};
+
+// A component-owned Element: one trimmable object with Inspector controls.
+// The managed absolute-fill root handles positioning in any composition size.
+export const AnimatedBackground = Interactive.create({
+ Component: AnimatedBackgroundInner,
+ layout: "absolute-fill",
+ schema: {
+ color: { type: "color", default: "#e3a253", description: "Grid color" },
+ backgroundColor: {
+ type: "color",
+ default: "#fff2dd",
+ description: "Background color",
+ },
+ },
+});
diff --git a/packages/template-element-library/elements/animated-title/animated-title.tsx b/packages/template-element-library/elements/animated-title/animated-title.tsx
new file mode 100644
index 0000000000..2d48b175bc
--- /dev/null
+++ b/packages/template-element-library/elements/animated-title/animated-title.tsx
@@ -0,0 +1,57 @@
+import {
+ Easing,
+ Interactive,
+ interpolate,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+
+// A wrapped Element: the title and its keyframes remain editable in Studio.
+export const AnimatedTitle = () => {
+ const frame = useCurrentFrame();
+ const { durationInFrames } = useVideoConfig();
+
+ return (
+ <Interactive.Div
+ name="Title"
+ style={{
+ width: 760,
+ height: 180,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ textAlign: "center",
+ fontFamily: "Arial, sans-serif",
+ fontSize: 104,
+ fontWeight: 700,
+ letterSpacing: -4,
+ lineHeight: 1.1,
+ whiteSpace: "nowrap",
+ color: "#202020",
+ translate: interpolate(
+ frame,
+ [0, 24, durationInFrames - 20, durationInFrames - 1],
+ ["0px 24px", "0px 0px", "0px 0px", "0px -16px"],
+ {
+ easing: Easing.bezier(0.22, 1, 0.36, 1),
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ },
+ ),
+ scale: interpolate(frame, [0, 28], [0.96, 1], {
+ easing: Easing.bezier(0.22, 1, 0.36, 1),
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ }),
+ opacity: interpolate(
+ frame,
+ [0, 16, durationInFrames - 20, durationInFrames - 1],
+ [0, 1, 1, 0],
+ { extrapolateLeft: "clamp", extrapolateRight: "clamp" },
+ ),
+ }}
+ >
+ Make it move.
+ </Interactive.Div>
+ );
+};
diff --git a/packages/template-element-library/elements/lower-third/lower-third.tsx b/packages/template-element-library/elements/lower-third/lower-third.tsx
new file mode 100644
index 0000000000..5916b5e313
--- /dev/null
+++ b/packages/template-element-library/elements/lower-third/lower-third.tsx
@@ -0,0 +1,87 @@
+import {
+ Easing,
+ Interactive,
+ interpolate,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+
+// Adapted from the official Name Lower Third: two editable layers, no fonts
+// or assets to download. Placement is left to Studio's installation wrapper.
+export const LowerThird = () => {
+ const frame = useCurrentFrame();
+ const { durationInFrames } = useVideoConfig();
+
+ return (
+ <div
+ style={{
+ width: 560,
+ height: 150,
+ position: "relative",
+ fontFamily: "Arial, sans-serif",
+ color: "#ffffff",
+ }}
+ >
+ <Interactive.Div
+ name="Name bar"
+ cropRight={interpolate(
+ frame,
+ [0, 20, durationInFrames - 24, durationInFrames - 4],
+ [1, 0, 0, 1],
+ {
+ easing: Easing.bezier(0.65, 0, 0.35, 1),
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ },
+ )}
+ style={{
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: 560,
+ height: 86,
+ boxSizing: "border-box",
+ padding: "20px 30px",
+ backgroundColor: "#174c3c",
+ color: "#ffffff",
+ fontSize: 40,
+ fontWeight: 700,
+ lineHeight: 1.15,
+ whiteSpace: "nowrap",
+ }}
+ >
+ Alex Morgan
+ </Interactive.Div>
+ <Interactive.Div
+ name="Role bar"
+ cropRight={interpolate(
+ frame,
+ [4, 24, durationInFrames - 28, durationInFrames - 8],
+ [1, 0, 0, 1],
+ {
+ easing: Easing.bezier(0.65, 0, 0.35, 1),
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ },
+ )}
+ style={{
+ position: "absolute",
+ top: 86,
+ left: 0,
+ width: 430,
+ height: 64,
+ boxSizing: "border-box",
+ padding: "18px 30px",
+ backgroundColor: "#ffffff",
+ color: "#174c3c",
+ fontSize: 25,
+ fontWeight: 500,
+ lineHeight: 1.1,
+ whiteSpace: "nowrap",
+ }}
+ >
+ Designer & storyteller
+ </Interactive.Div>
+ </div>
+ );
+};
diff --git a/packages/template-element-library/elements/registry.ts b/packages/template-element-library/elements/registry.ts
new file mode 100644
index 0000000000..6a2177d68d
--- /dev/null
+++ b/packages/template-element-library/elements/registry.ts
@@ -0,0 +1,100 @@
+import type {
+ ComponentDimensions,
+ ElementAsset,
+ ElementDependency,
+ ElementInitialProps,
+ ElementInstallationMode,
+} from "@remotion/studio-protocol";
+import type { ComponentType } from "react";
+import { AnimatedTitle } from "./animated-title/animated-title";
+import { LowerThird } from "./lower-third/lower-third";
+import { AnimatedBackground } from "./animated-background/animated-background";
+
+export type ElementDefinition = {
+ slug: string;
+ displayName: string;
+ category: string;
+ description: string;
+ usage: string;
+ component: ComponentType<Record<string, unknown>>;
+ width: number;
+ height: number;
+ fps: number;
+ durationInFrames: number;
+ posterFrame: number;
+ previewBackground: string;
+ dimensions: ComponentDimensions | null;
+ installationMode: ElementInstallationMode;
+ initialProps: ElementInitialProps | null;
+ installationProps: ElementInitialProps | null;
+ dependencies: readonly ElementDependency[];
+ assets: readonly ElementAsset[];
+};
+
+// Keep each source at elements/<slug>/<slug>.tsx; the website loads that same
+// file as raw text. Register authoring previews separately in remotion/Root.tsx.
+export const elements: readonly ElementDefinition[] = [
+ {
+ slug: "animated-title",
+ displayName: "Animated title",
+ category: "Text",
+ description: "A centered title with a soft entrance and exit.",
+ usage:
+ "Edit the text, typography, and animation directly in Studio. The title stays centered within its bounds.",
+ component: AnimatedTitle,
+ width: 1280,
+ height: 720,
+ fps: 30,
+ durationInFrames: 150,
+ posterFrame: 45,
+ previewBackground: "#eee9f7",
+ dimensions: { width: 760, height: 180 },
+ installationMode: "wrapped",
+ initialProps: null,
+ installationProps: null,
+ dependencies: [],
+ assets: [],
+ },
+ {
+ slug: "lower-third",
+ displayName: "Lower third",
+ category: "Overlays",
+ description: "An animated name and role label for your footage.",
+ usage:
+ "Edit the name, role, and bar colors in Studio. Position the group over your footage; the preview background is not installed.",
+ component: LowerThird,
+ width: 1280,
+ height: 720,
+ fps: 30,
+ durationInFrames: 150,
+ posterFrame: 45,
+ previewBackground: "#dcebe3",
+ dimensions: { width: 560, height: 150 },
+ installationMode: "wrapped",
+ initialProps: null,
+ installationProps: null,
+ dependencies: [],
+ assets: [],
+ },
+ {
+ slug: "animated-background",
+ displayName: "Moving grid",
+ category: "Backgrounds",
+ description: "A looping grid with adjustable background and line colors.",
+ usage:
+ "Place behind other layers. Change the grid and background colors in the Inspector. It fills its parent and loops over its duration.",
+ component: AnimatedBackground,
+ width: 1280,
+ height: 720,
+ fps: 30,
+ durationInFrames: 150,
+ posterFrame: 45,
+ previewBackground: "#fff2dd",
+ dimensions: null,
+ installationMode: "component-owned-sequence",
+ initialProps: { color: "#e3a253", backgroundColor: "#fff2dd" },
+ installationProps: null,
+ dependencies: [],
+ assets: [],
+ },
+];
diff --git a/packages/template-element-library/eslint.config.mjs b/packages/template-element-library/eslint.config.mjs
new file mode 100644
index 0000000000..aba68bf040
--- /dev/null
+++ b/packages/template-element-library/eslint.config.mjs
@@ -0,0 +1,6 @@
+import { makeConfig } from "@remotion/eslint-config-flat";
+
+export default [
+ { ignores: [".react-router/**", "build/**"] },
+ ...makeConfig({ remotionDir: ["elements/**", "remotion/**"] }),
+];
diff --git a/packages/template-element-library/lib/element-payload.ts b/packages/template-element-library/lib/element-payload.ts
new file mode 100644
index 0000000000..a59c2f5a7f
--- /dev/null
+++ b/packages/template-element-library/lib/element-payload.ts
@@ -0,0 +1,38 @@
+import { createElementPayload } from "@remotion/studio-protocol";
+import { elements } from "../elements/registry";
+
+// Only Vite imports this module. Studio imports the components normally and
+// does not need raw-loader configuration or generated source-code copies.
+const sources = import.meta.glob<string>("../elements/*/*.tsx", {
+ query: "?raw",
+ import: "default",
+ eager: true,
+});
+
+export const catalog = elements.map((definition) => {
+ const sourceCode =
+ sources[`../elements/${definition.slug}/${definition.slug}.tsx`];
+ if (!sourceCode) {
+ throw new Error(`Missing source for Element: ${definition.slug}`);
+ }
+
+ // Validate every entry at build time, not only when someone clicks Use.
+ const payload = createElementPayload({
+ slug: definition.slug,
+ displayName: definition.displayName,
+ sourceCode,
+ dimensions: definition.dimensions,
+ durationInFrames: definition.durationInFrames,
+ installationMode: definition.installationMode,
+ dependencies: definition.dependencies,
+ assets: definition.assets,
+ initialProps:
+ definition.installationProps === null
+ ? definition.initialProps
+ : { ...definition.initialProps, ...definition.installationProps },
+ });
+
+ return { definition, sourceCode, payload };
+});
+
+export type CatalogEntry = (typeof catalog)[number];
diff --git a/packages/template-element-library/lib/library-config.ts b/packages/template-element-library/lib/library-config.ts
new file mode 100644
index 0000000000..3660dae305
--- /dev/null
+++ b/packages/template-element-library/lib/library-config.ts
@@ -0,0 +1,8 @@
+export const libraryConfig = {
+ name: "Studio Supply",
+ description:
+ "Animations for your Remotion projects. Preview, install, and edit the source.",
+ // null registers the current website origin. Set an HTTPS URL to always
+ // register your production library, even when browsing a preview deployment.
+ url: null as string | null,
+};
diff --git a/packages/template-element-library/package.json b/packages/template-element-library/package.json
new file mode 100644
index 0000000000..3e1eaea22c
--- /dev/null
+++ b/packages/template-element-library/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "template-element-library",
+ "private": true,
+ "type": "module",
+ "engines": {
+ "node": "^22.22.0 || >=24"
+ },
+ "scripts": {
+ "dev": "react-router dev",
+ "build": "react-router build",
+ "preview": "vite preview",
+ "typecheck": "react-router typegen && tsc",
+ "lint": "eslint . && npm run typecheck",
+ "remotion:studio": "remotion studio"
+ },
+ "sideEffects": [
+ "*.css"
+ ],
+ "dependencies": {
+ "@heroicons/react": "2.2.0",
+ "@remotion/cli": "workspace:*",
+ "@remotion/player": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
+ "react": "19.2.7",
+ "react-dom": "19.2.7",
+ "react-router": "8.3.0",
+ "remotion": "workspace:*",
+ "isbot": "5.1.40"
+ },
+ "devDependencies": {
+ "@react-router/dev": "8.3.0",
+ "@react-router/node": "8.3.0",
+ "@remotion/eslint-config-flat": "workspace:*",
+ "@types/node": "22.20.0",
+ "@types/react": "19.2.7",
+ "@types/react-dom": "19.2.3",
+ "eslint": "10.12.0",
+ "prettier": "3.8.1",
+ "typescript": "5.9.3",
+ "vite": "7.3.6",
+ "tailwindcss": "4.2.0",
+ "@tailwindcss/vite": "4.2.0"
+ }
+}
diff --git a/packages/template-element-library/public/favicon.svg b/packages/template-element-library/public/favicon.svg
new file mode 100644
index 0000000000..357c8e3143
--- /dev/null
+++ b/packages/template-element-library/public/favicon.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><rect width="40" height="40" rx="9" fill="#da492d"/><path d="M10 11h20v22H10z" fill="none" stroke="#fff" stroke-width="3"/><path d="M10 11h12v22H10z" fill="#fff"/></svg>
diff --git a/packages/template-element-library/react-router.config.ts b/packages/template-element-library/react-router.config.ts
new file mode 100644
index 0000000000..e7d0276e4e
--- /dev/null
+++ b/packages/template-element-library/react-router.config.ts
@@ -0,0 +1,7 @@
+import type { Config } from "@react-router/dev/config";
+import { elements } from "./elements/registry";
+
+export default {
+ ssr: false,
+ prerender: ["/", ...elements.map((element) => `/elements/${element.slug}`)],
+} satisfies Config;
diff --git a/packages/template-element-library/remotion.config.ts b/packages/template-element-library/remotion.config.ts
new file mode 100644
index 0000000000..487020cc1d
--- /dev/null
+++ b/packages/template-element-library/remotion.config.ts
@@ -0,0 +1,6 @@
+import { Config } from "@remotion/cli/config";
+
+Config.setRspack(true);
+Config.setEntryPoint("remotion/index.ts");
+Config.setVideoImageFormat("jpeg");
+Config.setOverwriteOutput(true);
diff --git a/packages/template-element-library/remotion/ElementPreview.tsx b/packages/template-element-library/remotion/ElementPreview.tsx
new file mode 100644
index 0000000000..bd7607ca1d
--- /dev/null
+++ b/packages/template-element-library/remotion/ElementPreview.tsx
@@ -0,0 +1,46 @@
+import { Sequence } from "remotion";
+import { elements } from "../elements/registry";
+
+// The preview stage is deliberately not part of the installable source.
+export const ElementPreview = ({ slug }: { slug: string }) => {
+ const definition = elements.find((element) => element.slug === slug);
+ if (!definition) {
+ throw new Error(`Unknown Element: ${slug}`);
+ }
+ const Component = definition.component;
+ const dimensions = definition.dimensions;
+
+ return (
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ backgroundColor: definition.previewBackground,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ {dimensions ? (
+ <Sequence
+ layout="none"
+ width={dimensions.width}
+ height={dimensions.height}
+ durationInFrames={definition.durationInFrames}
+ >
+ <div
+ style={{
+ position: "relative",
+ width: dimensions.width,
+ height: dimensions.height,
+ }}
+ >
+ <Component {...(definition.initialProps ?? {})} />
+ </div>
+ </Sequence>
+ ) : (
+ <Component {...(definition.initialProps ?? {})} />
+ )}
+ </div>
+ );
+};
diff --git a/packages/template-element-library/remotion/Root.tsx b/packages/template-element-library/remotion/Root.tsx
new file mode 100644
index 0000000000..49e5ab8784
--- /dev/null
+++ b/packages/template-element-library/remotion/Root.tsx
@@ -0,0 +1,38 @@
+import { Composition } from "remotion";
+import { ElementPreview } from "./ElementPreview";
+
+// Keep registrations and defaultProps explicit so Studio can locate and save
+// edits. Match the preview metadata in elements/registry.ts.
+export const RemotionRoot = () => {
+ return (
+ <>
+ <Composition
+ id="animated-title"
+ component={ElementPreview}
+ width={1280}
+ height={720}
+ fps={30}
+ durationInFrames={150}
+ defaultProps={{ slug: "animated-title" }}
+ />
+ <Composition
+ id="lower-third"
+ component={ElementPreview}
+ width={1280}
+ height={720}
+ fps={30}
+ durationInFrames={150}
+ defaultProps={{ slug: "lower-third" }}
+ />
+ <Composition
+ id="animated-background"
+ component={ElementPreview}
+ width={1280}
+ height={720}
+ fps={30}
+ durationInFrames={150}
+ defaultProps={{ slug: "animated-background" }}
+ />
+ </>
+ );
+};
diff --git a/packages/template-element-library/remotion/index.ts b/packages/template-element-library/remotion/index.ts
new file mode 100644
index 0000000000..f31c790edb
--- /dev/null
+++ b/packages/template-element-library/remotion/index.ts
@@ -0,0 +1,4 @@
+import { registerRoot } from "remotion";
+import { RemotionRoot } from "./Root";
+
+registerRoot(RemotionRoot);
diff --git a/packages/template-element-library/tsconfig.json b/packages/template-element-library/tsconfig.json
new file mode 100644
index 0000000000..969d727935
--- /dev/null
+++ b/packages/template-element-library/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "include": ["**/*.ts", "**/*.tsx", ".react-router/types/**/*"],
+ "compilerOptions": {
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
+ "isolatedModules": true,
+ "esModuleInterop": true,
+ "jsx": "react-jsx",
+ "moduleResolution": "Bundler",
+ "resolveJsonModule": true,
+ "target": "ES2022",
+ "strict": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "noUnusedLocals": true,
+ "allowImportingTsExtensions": true,
+ "noEmit": true,
+ "types": ["node", "vite/client"],
+ "rootDirs": [".", ".react-router/types"],
+ "module": "ESNext"
+ },
+ "exclude": ["remotion.config.ts", "build", "node_modules"]
+}
diff --git a/packages/template-element-library/vercel.json b/packages/template-element-library/vercel.json
new file mode 100644
index 0000000000..67ece22b0e
--- /dev/null
+++ b/packages/template-element-library/vercel.json
@@ -0,0 +1,6 @@
+{
+ "buildCommand": "npm run build",
+ "outputDirectory": "build/client",
+ "framework": null,
+ "cleanUrls": true
+}
diff --git a/packages/template-element-library/vite.config.ts b/packages/template-element-library/vite.config.ts
new file mode 100644
index 0000000000..037589d23f
--- /dev/null
+++ b/packages/template-element-library/vite.config.ts
@@ -0,0 +1,8 @@
+import { reactRouter } from "@react-router/dev/vite";
+import { defineConfig } from "vite";
+import tailwindcss from "@tailwindcss/vite";
+
+export default defineConfig({
+ plugins: [reactRouter(), tailwindcss()],
+ server: { port: 5173 },
+});
diff --git a/tsconfig.json b/tsconfig.json
index d2abfdd3b2..39e9b57ebc 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -171,6 +171,9 @@
{
"path": "./packages/template-react-router"
},
+ {
+ "path": "./packages/template-element-library"
+ },
{
"path": "./packages/template-tiktok"
},