Schema Builder provides a field table for defining extraction schema keys, JSON types, descriptions, enums, nested objects, and arrays.
| Property key | Type | Description | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Installation
pnpm dlx shadcn@latest add @extend/schema-builder
Useful behaviors
- Form and JSON tabs share the same schema state.
- Type selector includes scalar JSON types, enum, object, and array options.
- Property keys can be reordered or dragged into and out of object and array object schemas.
- Enum values can be reordered.
- Enum rows support editable values and descriptions.
- Object rows render a nested schema table below the parent row.
- Array rows support object, enum, or scalar item types; object arrays render a nested item schema table and enum arrays render an enum table.
- JSON view matches the app code block surface and follows the current light or dark theme.
API Reference
SchemaBuilderPanel
The SchemaBuilderPanel component renders the editable schema table and a JSON view for the serialized schema.
| Prop | Type | Default | Required |
|---|---|---|---|
className | string | - | No |
defaultSchema | SchemaBuilderSchema | sample schema | No |
schema | SchemaBuilderSchema | - | No |
onSchemaChange | (schema: SchemaBuilderSchema) => void | - | No |
theme | "light" | "dark" | app theme | No |
SchemaBuilderProperty
| Prop | Type | Default | Required |
|---|---|---|---|
id | string | - | Yes |
key | string | - | Yes |
type | SchemaBuilderFieldType | - | Yes |
description | string | - | Yes |
enumValues | SchemaBuilderEnumValue[] | - | No |
properties | SchemaBuilderProperty[] | - | No |
items | { type; properties?; enumValues? } | - | No |