Skip to main content

API Reference

Quick reference of all public exports from each eSheet package.

@esheet/core

Types

ExportKindDescription
FormDefinitionInterfaceTop-level form structure
FieldDefinitionInterfaceSingle field structure
FieldResponseInterfaceResponse values for a field
FormResponseType aliasRecord<string, FieldResponse>
SelectedOptionInterface{ id, value } for selected options
FieldTypeTypeUnion of 19 field type strings
TextInputTypeTypeUnion of 9 text input variants
FieldOptionInterfaceOption in a choice field
MatrixRow / MatrixColumnInterfaceMatrix dimensions
ConditionalRuleInterfaceConditional rule structure
ConditionInterfaceSingle condition
ConditionOperatorTypeUnion of 10 operators
ConditionalEffectType'visible' | 'enable' | 'required'
LogicModeType'AND' | 'OR'
FieldCategoryTypeField grouping category
AnswerTypeTypeHow a field stores its answer
FieldTypeMetaInterfaceField type metadata
FieldTypeRegistryTypeRegistry map
FieldComponentPropsInterfaceProps contract for field components
ResponseItemInterface{ id, text, answer } — one per answerable field, returned by hydrateResponse
FieldNodeInterfaceNode in normalized definition tree
OptionBearingFieldDefinitionTypeUnion of field definitions that have options
NormalizedDefinitionInterfaceFlat normalized representation of a form
AddFieldOptionsInterfaceOptions for FormStore.addField()
TextFieldDefinitionInterfaceDefinition for text fields
LongtextFieldDefinitionInterfaceDefinition for longtext fields
MultitextFieldDefinitionInterfaceDefinition for multitext fields
RadioFieldDefinitionInterfaceDefinition for radio fields
CheckFieldDefinitionInterfaceDefinition for check fields
BooleanFieldDefinitionInterfaceDefinition for boolean fields
DropdownFieldDefinitionInterfaceDefinition for dropdown fields
MultiselectDropdownFieldDefinitionInterfaceDefinition for multiselect dropdown fields
RatingFieldDefinitionInterfaceDefinition for rating fields
RankingFieldDefinitionInterfaceDefinition for ranking fields
SliderFieldDefinitionInterfaceDefinition for slider fields
SingleMatrixFieldDefinitionInterfaceDefinition for single-select matrix fields
MultiMatrixFieldDefinitionInterfaceDefinition for multi-select matrix fields
ImageFieldDefinitionInterfaceDefinition for image fields
HtmlFieldDefinitionInterfaceDefinition for HTML fields
SignatureFieldDefinitionInterfaceDefinition for signature fields
DiagramFieldDefinitionInterfaceDefinition for diagram fields
DisplayFieldDefinitionInterfaceDefinition for display fields
SectionFieldDefinitionInterfaceDefinition for section fields

Type Predicates

ExportDescription
hasOptionsType predicate for fields with options property

Constants

ExportDescription
FIELD_TYPESArray of 19 field type strings
TEXT_INPUT_TYPESArray of 9 text input type strings
CONDITION_OPERATORSArray of 10 operator strings
CONDITIONAL_EFFECTSArray of 3 effect strings

Zod Schemas

ExportValidates
formDefinitionSchemaFormDefinition
fieldDefinitionSchemaFieldDefinition
fieldTypeSchemaFieldType
conditionSchemaCondition
conditionalRuleSchemaConditionalRule
formDefinitionJSONSchemaJSON Schema (Draft-07) for Monaco

Store Factories

ExportReturnsDescription
createFormStore(def?)FormStoreCreate a new form state store
createUIStore()UIStoreCreate a new UI state store

Logic & Validation

ExportDescription
evaluateRule(rule, normalized, responses)Evaluate a conditional rule
evaluateCondition(condition, definition, response)Evaluate a single condition
evaluateExpression(expression, normalized, responses)Evaluate an expression string
isExpressionValid(expr)Validate expression syntax
resolveEffect(effect, field, normalized, responses)Resolve a conditional effect
validateField(fieldId, normalized, responses)Validate a single field
validateForm(normalized, responses)Validate all fields

Utilities

ExportDescription
normalizeDefinition(def)Convert tree → flat normalized state
hydrateDefinition(normalized)Convert flat → nested tree
hydrateResponse(normalized, responses)Walk normalized definition and return ResponseItem[] for export/submission
generateFieldId(fieldType)Generate a unique field ID
generateOptionId()Generate a unique option ID
generateRowId()Generate a unique matrix row ID
generateColumnId()Generate a unique matrix column ID
formatZodValidationError(error)Format Zod validation errors into readable strings

Registry

ExportDescription
registerFieldType(key, meta)Register a field type
registerFieldElements(elements)Batch-register UI element classes for field types
getFieldTypeMeta(key)Get field type metadata
getRegisteredFieldTypes()List all registered types

@esheet/fields

Components

All 19 field components: TextField, LongTextField, MultiTextField, RadioField, CheckField, BooleanField, DropdownField, MultiSelectDropdownField, RatingField, RankingField, SliderField, SingleMatrixField, MultiMatrixField, SectionField, DisplayField, HtmlField, ImageField, SignatureField, DiagramField

Custom Controls

ExportDescription
CustomRadioStyled radio with onSelect/onUnselect
CustomCheckboxStyled checkbox
CustomDropdownStyled dropdown
DrawingPadCanvas drawing component

Drawing Types

ExportDescription
DrawingDataDrawing canvas data structure
DrawingPadConfigConfiguration options for DrawingPad
DrawingPadPayloadPayload emitted by DrawingPad on change
NormalizedPoint{ x, y } coordinate normalized to canvas size
StrokeSingle stroke in a drawing (array of NormalizedPoint)

Icons

ExportDescription
TrashIconTrash / delete icon
PlusIconPlus / add icon
ArrowUpIconArrow up icon
ArrowDownIconArrow down icon
UpDownArrowIconUp-down (reorder) arrow icon

Registry

ExportDescription
registerCustomFieldTypes(types)Register custom field types with components
registerFieldComponents(map)Register a map of field type -> React component
getFieldComponent(fieldType)Get the React component for a field type
getRegisteredComponentKeys()List all registered field component keys

Context

ExportDescription
FormStoreContextReact context for FormStore
UIContextReact context for UIStore
useFormStore()Hook to access FormStore
useUI()Hook to access UIStore

@esheet/builder

Components

ExportDescription
EsheetBuilderMain builder component
BuilderHeaderMode switcher header (advanced)
CodeViewJSON/YAML editor (advanced)
FieldWrapperSelection chrome wrapper (advanced)

Hooks & Context

ExportDescription
useFormStore()Access FormStore from context
useUI()Access UIStore from context
useInstanceId()Get unique instance ID
FormStoreContextFormStore React context
UIContextUIStore React context
InstanceIdContextInstance ID React context
useFormApi()Hook returning imperative form API
useUiApi()Hook returning imperative UI API
useVisibleRootIds()Hook returning visible root field IDs

MCP Integration

ExportDescription
executeToolCallExecute a builder tool call
BUILDER_TOOL_DEFINITIONSArray of MCP tool definitions for builder
BUILDER_SYSTEM_PROMPTSystem prompt describing builder tools
useBuilderMcpToolHandlerHook for handling MCP tool calls in React

Types

ExportDescription
EsheetBuilderPropsBuilder component props
CodeViewPropsProps for CodeView
FieldWrapperPropsProps for FieldWrapper
FieldWrapperRenderPropsRender props passed to FieldWrapper children
FormApiImperative form API interface
FieldResponseMapMap of field IDs to responses
UiApiImperative UI API interface
ToolDefinitionMCP tool definition type
UseBuilderMcpToolHandlerOptionsOptions for useBuilderMcpToolHandler

@esheet/renderer

Components

ExportDescription
EsheetRendererMain renderer component (forwardRef)
RendererBodyInner renderer body (advanced)
FieldNodeRenders a single field node inside the renderer (advanced)

Hooks

ExportDescription
useRendererInit()Initialize renderer with form data (advanced)

MCP Integration

ExportDescription
executeToolCallExecute a renderer tool call
RENDERER_TOOL_DEFINITIONSArray of MCP tool definitions for renderer
RENDERER_SYSTEM_PROMPTSystem prompt describing renderer tools
useRendererMcpToolHandlerHook for handling MCP tool calls in React

Types

ExportDescription
EsheetRendererPropsRenderer component props
EsheetRendererHandleRef handle type (getRawResponse, getValidResponse, getFormStore, getUIStore)
RendererToolsType for renderer MCP tool names
ToolDefinitionMCP tool definition type
UseRendererMcpToolHandlerOptionsOptions for useRendererMcpToolHandler

EsheetRendererProps

PropTypeDefaultDescription
formDataInputunknownrequiredForm definition (object, JSON string, YAML string, MCP, SurveyJS)
classNamestring''Additional CSS class for the root container
initialResponsesFormResponse--Pre-fill response data
strictbooleanfalseDisable auto-detection, require a valid FormDefinition
onReady() => void--Called when the renderer is initialized
onRendererToolsReady(tools: RendererTools) => void--Called with MCP tool handler when ready

@esheet/renderer-standalone

Functions

ExportDescription
mountStandaloneRenderer(container, props)Mount EsheetRenderer into a DOM node and return a control handle

Types

ExportDescription
EsheetRendererStandaloneHandleHandle with unmount(), getResponse(), and getValidResponse()

@esheet/renderer-blaze

Functions

ExportDescription
registerBlazeTemplate(templateName?)Register a Blaze template wrapper for the renderer. Returns false when required Blaze globals are not available, otherwise true.

registerBlazeTemplate uses esheetRenderer as the default template name when no argument is provided.


@esheet/adapters

Bidirectional converters for SurveyJS and MCP elicitation formats.

See the Adapters section in the sidebar for detailed documentation including: