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:- Runtime validation - Validate data at runtime
- Type generation - Generate TypeScript types for the SDK client
- 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:Type Helpers
ZuiObjectSchema
ZuiObjectOrRefSchema
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.See Also
- Zod Documentation - Complete Zod reference
- IntegrationDefinition - Using ZUI in integrations
- InterfaceDefinition - Using ZUI in interfaces
- Messages - Pre-built message schemas