diff --git a/README.md b/README.md
index ec029ea5..d2199812 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,7 @@ resistorProps.parse({ resistance: "10k" } as ResistorPropsInput);
| `` | [`SchematicRectProps`](#schematicrectprops-schematicrect) |
| `` | [`SchematicRowProps`](#schematicrowprops-schematicrow) |
| `` | [`SchematicSectionProps`](#schematicsectionprops-schematicsection) |
+| `` | [`SchematicSheetProps`](#schematicsheetprops-schematicsheet) |
| `` | [`SchematicTableProps`](#schematictableprops-schematictable) |
| `` | [`SchematicTextProps`](#schematictextprops-schematictext) |
| `` | [`SilkscreenCircleProps`](#silkscreencircleprops-silkscreencircle) |
@@ -163,6 +164,10 @@ export interface CommonComponentProps extends CommonLayoutProps {
* This component will be drawn as part of this section e.g. "Power"
*/
schSectionName?: string;
+ /**
+ * This component will be drawn as part of this sheet e.g. "Main"
+ */
+ schSheetName?: string;
}
```
@@ -1615,6 +1620,18 @@ export interface SchematicSectionProps {
[Source](https://github.com/tscircuit/props/blob/main/lib/components/schematic-section.ts)
+### SchematicSheetProps ``
+
+```ts
+export interface SchematicSheetProps {
+ name: string;
+ displayName: string;
+ children?: any;
+}
+```
+
+[Source](https://github.com/tscircuit/props/blob/main/lib/components/schematic-sheet.ts)
+
### SchematicTableProps ``
```ts
diff --git a/generated/COMPONENT_TYPES.md b/generated/COMPONENT_TYPES.md
index 8f57de72..b3a3a92e 100644
--- a/generated/COMPONENT_TYPES.md
+++ b/generated/COMPONENT_TYPES.md
@@ -550,6 +550,7 @@ export interface CommonComponentProps
mfn?: string
manufacturerPartNumber?: string
schSectionName?: string
+ schSheetName?: string
}
.extend({
key: z.any().optional(),
@@ -561,6 +562,12 @@ export interface CommonComponentProps
.describe(
'This component will be drawn as part of this section e.g. "Power"',
),
+ schSheetName: z
+ .string()
+ .optional()
+ .describe(
+ 'This component will be drawn as part of this sheet e.g. "Main"',
+ ),
datasheetUrl: url.optional(),
cadModel: cadModelProp.optional(),
kicadFootprintMetadata: kicadFootprintMetadata.optional(),
@@ -3564,6 +3571,21 @@ export const schematicSectionProps = z.object({
})
```
+### schematic-sheet
+
+```typescript
+export interface SchematicSheetProps {
+ name: string
+ displayName: string
+ children?: any
+}
+export const schematicSheetProps = z.object({
+ name: z.string(),
+ displayName: z.string(),
+ children: z.any().optional(),
+})
+```
+
### schematic-table
```typescript
diff --git a/generated/PROPS_OVERVIEW.md b/generated/PROPS_OVERVIEW.md
index 57959ede..374ea9a7 100644
--- a/generated/PROPS_OVERVIEW.md
+++ b/generated/PROPS_OVERVIEW.md
@@ -543,9 +543,13 @@ export interface CommonComponentProps
mfn?: string
manufacturerPartNumber?: string
/**
- *This component will be drawn as part of this section e.g. \"Power\
+ * This component will be drawn as part of this section e.g. "Power"
*/
schSectionName?: string
+ /**
+ * This component will be drawn as part of this sheet e.g. "Main"
+ */
+ schSheetName?: string
}
@@ -1982,6 +1986,13 @@ export interface SchematicSectionProps {
}
+export interface SchematicSheetProps {
+ name: string
+ displayName: string
+ children?: any
+}
+
+
export interface SchematicTableProps {
schX?: number | string
schY?: number | string
diff --git a/lib/common/layout.ts b/lib/common/layout.ts
index b5223ade..c3606f3d 100644
--- a/lib/common/layout.ts
+++ b/lib/common/layout.ts
@@ -261,9 +261,13 @@ export interface CommonComponentProps
mfn?: string
manufacturerPartNumber?: string
/**
- *This component will be drawn as part of this section e.g. \"Power\
+ * This component will be drawn as part of this section e.g. "Power"
*/
schSectionName?: string
+ /**
+ * This component will be drawn as part of this sheet e.g. "Main"
+ */
+ schSheetName?: string
}
export const commonComponentProps = commonLayoutProps
@@ -278,6 +282,12 @@ export const commonComponentProps = commonLayoutProps
.describe(
'This component will be drawn as part of this section e.g. "Power"',
),
+ schSheetName: z
+ .string()
+ .optional()
+ .describe(
+ 'This component will be drawn as part of this sheet e.g. "Main"',
+ ),
datasheetUrl: url.optional(),
cadModel: cadModelProp.optional(),
kicadFootprintMetadata: kicadFootprintMetadata.optional(),
diff --git a/lib/components/schematic-sheet.ts b/lib/components/schematic-sheet.ts
new file mode 100644
index 00000000..6e04c8e6
--- /dev/null
+++ b/lib/components/schematic-sheet.ts
@@ -0,0 +1,18 @@
+import { z } from "zod"
+import { expectTypesMatch } from "lib/typecheck"
+
+export interface SchematicSheetProps {
+ name: string
+ displayName: string
+ children?: any
+}
+
+export const schematicSheetProps = z.object({
+ name: z.string(),
+ displayName: z.string(),
+ children: z.any().optional(),
+})
+
+export type InferredSchematicSheetProps = z.input
+
+expectTypesMatch>(true)
diff --git a/lib/index.ts b/lib/index.ts
index 6f5c9b88..b8f12c8a 100644
--- a/lib/index.ts
+++ b/lib/index.ts
@@ -108,6 +108,7 @@ export * from "./components/schematic-table"
export * from "./components/schematic-row"
export * from "./components/schematic-cell"
export * from "./components/schematic-section"
+export * from "./components/schematic-sheet"
export * from "./components/copper-text"
export * from "./components/silkscreen-text"
export * from "./components/silkscreen-path"
diff --git a/scripts/generate-readme-docs.ts b/scripts/generate-readme-docs.ts
index 80ba71cb..3de6df93 100644
--- a/scripts/generate-readme-docs.ts
+++ b/scripts/generate-readme-docs.ts
@@ -188,6 +188,10 @@ function generateInterfaceDefinitions(
* This component will be drawn as part of this section e.g. "Power"
*/
schSectionName?: string
+ /**
+ * This component will be drawn as part of this sheet e.g. "Main"
+ */
+ schSheetName?: string
}`,
filePath: "lib/common/layout.ts",
},
diff --git a/tests/schematic-sheet.test.ts b/tests/schematic-sheet.test.ts
new file mode 100644
index 00000000..5afad4a0
--- /dev/null
+++ b/tests/schematic-sheet.test.ts
@@ -0,0 +1,34 @@
+import { expect, test } from "bun:test"
+import {
+ schematicSheetProps,
+ type SchematicSheetProps,
+} from "lib/components/schematic-sheet"
+import { expectTypeOf } from "expect-type"
+
+test("should parse schematic sheet with name, displayName, and children", () => {
+ const raw: SchematicSheetProps = {
+ name: "main",
+ displayName: "Main Sheet",
+ children: [{ type: "resistor", props: { name: "R1" } }],
+ }
+
+ expectTypeOf(raw).toMatchTypeOf()
+ const parsed = schematicSheetProps.parse(raw)
+ expect(parsed.name).toBe("main")
+ expect(parsed.displayName).toBe("Main Sheet")
+ expect(parsed.children).toEqual([{ type: "resistor", props: { name: "R1" } }])
+})
+
+test("should parse schematic sheet without children", () => {
+ const raw: SchematicSheetProps = {
+ name: "power",
+ displayName: "Power Sheet",
+ }
+
+ const parsed = schematicSheetProps.parse(raw)
+ expect(parsed.children).toBeUndefined()
+})
+
+test("should fail without displayName", () => {
+ expect(() => schematicSheetProps.parse({ name: "main" })).toThrow()
+})