Skip to main content
ZUI (Zod UI) is Botpress’s schema system built on top of Zod. It extends Zod with additional metadata for automatic UI generation in Botpress Studio and the Dashboard.

Import

ZUI is a re-export of the @bpinternal/zui package with Botpress-specific extensions. It includes all standard Zod functionality plus UI metadata capabilities.

Overview

ZUI schemas serve three purposes:
  1. Runtime validation - Validate data at runtime
  2. Type generation - Generate TypeScript types for the SDK client
  3. UI generation - Generate forms and UI components in Botpress Studio

Basic Usage

ZUI schemas are used throughout Botpress definitions:

UI Metadata Methods

ZUI extends Zod schemas with methods for UI generation:

title()

Sets the display label in UI forms:

describe()

Adds help text shown below the field:

placeholder()

Sets placeholder text for input fields:

default()

Sets a default value:

hidden()

Hides the field from UI forms (but still validates):

Standard Zod Types

All standard Zod types are available:

Primitives

String Validations

Number Validations

Objects

Arrays

Enums

Unions

Literals

Records

Tuples

ZUI-Specific Types

z.ref()

Create entity references for use in interfaces:
Entity references are automatically created when defining interfaces. You typically don’t need to create them manually.

Generic Schemas

Interfaces use generic schemas that accept entity type parameters:
Usage in interface definitions:

Type Helpers

ZuiObjectSchema

Type representing object-like schemas (objects or records).

ZuiObjectOrRefSchema

Type representing object schemas or entity references.

Utility Functions

mergeObjectSchemas()

Merge two object schemas:

Complete Configuration Example

integration.definition.ts

Validation Example

ZUI schemas validate data at runtime:

TypeScript Integration

Extract TypeScript types from ZUI schemas:

Best Practices

Always add UI metadata - Use .title() and .describe() on all fields to provide a good user experience in Botpress Studio.
Use specific validations - Add constraints like .min(), .max(), .email(), .url() to ensure data quality.
Provide sensible defaults - Use .default() for optional configuration to reduce setup friction.
Avoid circular references - ZUI schemas cannot have circular references. Use entity references via interfaces instead.

See Also