View Builder Package
The@repo/view-builder
package provides a visual interface for creating and editing view schemas used by the @repo/view
package. It offers a drag-and-drop canvas, component toolbox, JSON editor, and AI-assisted schema generation.
Features
- Visual Builder: Drag-and-drop interface for creating view schemas
- Live Preview: Real-time preview of the view being created
- JSON Editor: Direct editing of the underlying JSON schema
- AI Assistance: AI-powered suggestions for view creation
- Schema Validation: Automatic validation of view schemas
- Persistence: Save and load view schemas
- Internationalization: Support for multiple languages
Installation
This package is part of thezopio
monorepo and is available to all applications in the workspace.
Package Structure
The View Builder package is organized into several subpackages:- Canvas: Drag-and-drop interface for visual editing
- Toolbox: Component palette for adding fields and elements
- JSON Editor: Direct editing of the schema JSON
- AI: AI-assisted schema generation
- Hooks: React hooks for state management
Dependencies
The View Builder package depends on the following packages:- @repo/view: For rendering and validating view schemas
- @repo/design-system: For UI components
- @repo/crud: For schema definitions and field types
Basic Usage
Using the View Builder Component
Integrating with Custom Components
Using the Schema State Hook
Core Components
DragDropCanvas
The canvas component provides a visual interface for building views:Toolbox
The toolbox component provides a palette of available components and fields:JSONEditor
The JSON editor component allows direct editing of the schema JSON:AIPromptPanel
The AI prompt panel provides AI-assisted schema generation:Internationalization
The View Builder package supports internationalization using the same locales as the View package:- English (en)
- Turkish (tr)
- Spanish (es)
- German (de)