Skip to content

🎥 Make videos programmatically with React

zod color

Jonny Burger2f50ca3e1d62
diff --git a/packages/docs/components/TableOfContents/remotion.tsx b/packages/docs/components/TableOfContents/remotion.tsx
index 2d73ef7308..e0e697cc3a 100644
--- a/packages/docs/components/TableOfContents/remotion.tsx
+++ b/packages/docs/components/TableOfContents/remotion.tsx
@@ -132,10 +132,6 @@ export const TableOfContents: React.FC = () => {
<strong>getInputProps()</strong>
<div>Receive the user-defined input data</div>
</TOCItem>
- <TOCItem link="/docs/z">
- <strong>z</strong>
- <div>The Zod library</div>
- </TOCItem>
</Grid>
<h2>Assets</h2>
<Grid>
diff --git a/packages/docs/components/TableOfContents/z-color.tsx b/packages/docs/components/TableOfContents/z-color.tsx
new file mode 100644
index 0000000000..2d68249967
--- /dev/null
+++ b/packages/docs/components/TableOfContents/z-color.tsx
@@ -0,0 +1,16 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/z-color/z-color">
+ <strong>{"zColor()"}</strong>
+ <div>A Zod Type for colors</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/docs/parametrized-rendering.md b/packages/docs/docs/parametrized-rendering.md
index 3250e73c85..9423c30255 100644
--- a/packages/docs/docs/parametrized-rendering.md
+++ b/packages/docs/docs/parametrized-rendering.md
@@ -74,10 +74,10 @@ Default props are useful so you don't preview your video with no data. Default p
## Define a schema <AvailableFrom v="4.0.0"/>
-You can use [`z`](/docs/z) to define a typesafe schema for your composition.
+You can use [`z`](https://github.com/colinhacks/zod) to define a typesafe schema for your composition.
```tsx twoslash title="MyComp.tsx"
-import { z } from "remotion";
+import { z } from "zod";
export const myCompSchema = z.object({
propOne: z.string(),
diff --git a/packages/docs/docs/z-color/index.md b/packages/docs/docs/z-color/index.md
new file mode 100644
index 0000000000..e9e0ae4501
--- /dev/null
+++ b/packages/docs/docs/z-color/index.md
@@ -0,0 +1,48 @@
+---
+sidebar_label: Overview
+title: "@remotion/z-color"
+crumb: Schema
+---
+
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
+import {TableOfContents} from '../../components/TableOfContents/rive';
+
+This package provides a component for rendering [Rive](https://rive.app) animations in Remotion.
+
+## Installation
+
+Install `@remotion/rive`
+
+<Tabs defaultValue="npm" values={[
+{ label: 'npm', value: 'npm', },
+{ label: 'yarn', value: 'yarn', },
+{ label: 'pnpm', value: 'pnpm', },
+]
+}>
+<TabItem value="npm">
+
+```bash
+npm i @remotion/z-color
+```
+
+</TabItem>
+<TabItem value="yarn">
+```bash
+yarn add @remotion/z-color
+```
+</TabItem>
+<TabItem value="pnpm">
+```bash
+pnpm i @remotion/z-color
+```
+</TabItem>
+</Tabs>
+
+## API
+
+<TableOfContents />
+
+## License
+
+[Remotion License](https://remotion.dev/license)
diff --git a/packages/docs/docs/z-color.md b/packages/docs/docs/z-color/z-color.md
similarity index 77%
rename from packages/docs/docs/z-color.md
rename to packages/docs/docs/z-color/z-color.md
index 3fb26f585b..6ed9845dfc 100644
--- a/packages/docs/docs/z-color.md
+++ b/packages/docs/docs/z-color/z-color.md
@@ -1,7 +1,7 @@
---
image: /generated/articles-docs-z-color.png
-id: z-color
title: zColor()
+slug: z-color/z-color
---
Using `zColor()`, you can specify in your [schema](/docs/parametrized-rendering) that a string has to be a color.
@@ -10,5 +10,4 @@ In the Remotion Preview, a color picker will be displayed allowing to change and
## See also
-- [Parametrized rendereding](/docs/parametrized-rendering)
-- [`z`](/docs/z)
+- [Parametrized rendering](/docs/parametrized-rendering)
diff --git a/packages/docs/docs/z.md b/packages/docs/docs/z.md
deleted file mode 100644
index 36c3dd0375..0000000000
--- a/packages/docs/docs/z.md
+++ /dev/null
@@ -1,90 +0,0 @@
----
-image: /generated/articles-docs-z.png
-id: z
-title: z
-crumb: "API"
----
-
-<AvailableFrom v="4.0.0" /><br/><br/>
-
-`z` is a re-export of the Zod library (version `3.21.4`).
-
-You may use it to define schemas for compositions in order to make the input props type-safe.
-
-## Example
-
-The following usage is recommended, since it will make `defaultProps` type-safe and them editable in the schema editor in the Remotion Preview:
-
-```tsx twoslash title="MyComp.tsx" {1-11,18}
-import { z } from "remotion";
-
-export const myCompSchema = z.object({
- title: z.string(),
- subtitle: z.string(),
-});
-
-export const MyComp: React.FC<z.infer<typeof myCompSchema>> = ({
- title,
- subtitle,
-}) => {
- return (
- <div>
- <h1>{title}</h1>
- <h2>{subtitle}</h2>
- </div>
- );
-};
-```
-
-```tsx twoslash title="Root.tsx" {9,14-18}
-// @filename: MyComp.tsx
-import React from "react";
-import { z } from "remotion";
-
-export const myCompSchema = z.object({
- title: z.string(),
- subtitle: z.string(),
-});
-
-export const MyComp: React.FC<z.infer<typeof myCompSchema>> = ({
- title,
- subtitle,
-}) => {
- return (
- <div>
- <h1>{title}</h1>
- <h2>{subtitle}</h2>
- </div>
- );
-};
-
-// @filename: Root.tsx
-// organize-imports-ignore
-// ---cut---
-import React from "react";
-import { Composition } from "remotion";
-import { MyComp, myCompSchema } from "./MyComp";
-
-export const RemotionRoot: React.FC = () => {
- return (
- <Composition
- id="my-comp"
- component={MyComp}
- durationInFrames={100}
- fps={30}
- width={1920}
- height={1080}
- schema={myCompSchema}
- defaultProps={{
- title: "Hello World",
- subtitle: "Welcome to Remotion",
- }}
- />
- );
-};
-```
-
-## See also
-
-- [Parametrized rendereding](/docs/parametrized-rendering)
-- [`zColor()`](/docs/z-color)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 1fc242b3a1..ac24bda3fe 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -83,8 +83,6 @@ module.exports = {
"series",
"folder",
"easing",
- "z",
- "z-color",
"null",
"clipper",
],
@@ -330,6 +328,15 @@ module.exports = {
},
items: ["rive/index", "rive/remotionrivecanvas"],
},
+ {
+ type: "category",
+ label: "@remotion/z-color",
+ link: {
+ type: "doc",
+ id: "z-color/index",
+ },
+ items: ["z-color/z-color"],
+ },
],
mainSidebar: [
"4-0-alpha",