277

Schema Builder

Build extraction schemas with a table editor and synchronized JSON view.

Schema Builder provides a field table for defining extraction schema keys, JSON types, descriptions, enums, nested objects, and arrays.

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.

PropTypeDefaultRequired
classNamestring-No
defaultSchemaSchemaBuilderSchemasample schemaNo
schemaSchemaBuilderSchema-No
onSchemaChange(schema: SchemaBuilderSchema) => void-No
theme"light" | "dark"app themeNo

SchemaBuilderProperty

PropTypeDefaultRequired
idstring-Yes
keystring-Yes
typeSchemaBuilderFieldType-Yes
descriptionstring-Yes
enumValuesSchemaBuilderEnumValue[]-No
propertiesSchemaBuilderProperty[]-No
items{ type; properties?; enumValues? }-No