Skip to content

🎥 Make videos programmatically with React

improve docs

Jonny Burger8a8b331bc887
diff --git a/packages/docs/docs/loop.md b/packages/docs/docs/loop.md
index de548b12eb..63ca0ab008 100644
--- a/packages/docs/docs/loop.md
+++ b/packages/docs/docs/loop.md
@@ -24,7 +24,7 @@ The Loop component is a high order component and accepts, besides it's children,
- `layout`: _(optional)_: Either `"absolute-fill"` _(default)_ or `"none"` By default, your content will be absolutely positioned. If you would like to disable layout side effects, pass `layout="none"`.
-- `style`: _(optional)_: CSS styles to be applied to the container. If `layout` is set to `none`, there is no container and setting this style is not allowed.
+- `style`: _(optional, available from v3.3.4)_: CSS styles to be applied to the container. If `layout` is set to `none`, there is no container and setting this style is not allowed.
:::info
Good to know: You can nest loops within each other and they will cascade. For example, a loop that has a duration of 30 frames which is inside a loop that has a duration of 75 will play 2 times. However, nested loops are not currently displayed in the timeline.
diff --git a/packages/docs/docs/series.md b/packages/docs/docs/series.md
index ffc79c9bae..fadaa8049e 100644
--- a/packages/docs/docs/series.md
+++ b/packages/docs/docs/series.md
@@ -18,7 +18,7 @@ const Square: React.FC<{color: string}> = () => <div></div>
// - Square
```
-```tsx twoslash
+```tsx twoslash title="src/Example.tsx"
// @include: example-Square
// ---cut---
import { Series } from "remotion";
@@ -63,23 +63,28 @@ This component is a high order component, and accepts, besides it's children, th
- `layout`: _(optional)_: Either `"absolute-fill"` _(default)_ or `"none"` By default, your sequences will be absolutely positioned, so they will overlay each other. If you would like to opt out of it and handle layouting yourself, pass `layout="none"`.
-- `style`: _(optional)_: CSS styles to be applied to the container. If `layout` is set to `none`, there is no container and setting this style is not allowed.
+- `style`: _(optional, available from v3.3.4)_: CSS styles to be applied to the container. If `layout` is set to `none`, there is no container and setting this style is not allowed.
-- `ref`: _(optional)_: You can add a [React ref](https://reactjs.org/docs/refs-and-the-dom.html) to a `<Series.Sequence>`. If you use TypeScript, you need to type it with `HTMLDivElement`:
+- `ref`: _(optional, available from v3.3.4)_: You can add a [React ref](https://reactjs.org/docs/refs-and-the-dom.html) to a `<Series.Sequence>`. If you use TypeScript, you need to type it with `HTMLDivElement`:
-```tsx
-import { useRef } from "react";
+```tsx twoslash title="src/Example.tsx"
+const Square: React.FC<{
+ color: string;
+}> = () => null;
+// ---cut---
+import React, { useRef } from "react";
import { Series } from "remotion";
const Example: React.FC = () => {
const first = useRef<HTMLDivElement>(null);
const second = useRef<HTMLDivElement>(null);
+
return (
<Series>
<Series.Sequence durationInFrames={40} ref={first}>
<Square color={"#3498db"} />
</Series.Sequence>
- <Series.Sequence durationInFrames={20} ref="second">
+ <Series.Sequence durationInFrames={20} ref={second}>
<Square color={"#5ff332"} />
</Series.Sequence>
<Series.Sequence durationInFrames={70}>
diff --git a/packages/example/src/Freeze/FreezeExample.tsx b/packages/example/src/Freeze/FreezeExample.tsx
index 49e66eec0a..05089279b1 100644
--- a/packages/example/src/Freeze/FreezeExample.tsx
+++ b/packages/example/src/Freeze/FreezeExample.tsx
@@ -1,8 +1,9 @@
-import React from 'react';
+import React, {useRef} from 'react';
import {Freeze, Series, staticFile, Video} from 'remotion';
export const FreezeExample: React.FC = () => {
const video = staticFile('framermp4withoutfileextension');
+ const ref = useRef<HTMLDivElement>(null);
return (
<Series>
@@ -11,7 +12,7 @@ export const FreezeExample: React.FC = () => {
<Video src={video} />
</Freeze>
</Series.Sequence>
- <Series.Sequence durationInFrames={50}>
+ <Series.Sequence ref={ref} durationInFrames={50}>
<Video src={video} />
</Series.Sequence>
<Series.Sequence durationInFrames={50}>