Skip to content

Commit 22d235e

Browse files
Copilothotlong
andcommitted
Add custom components and React renderer examples
Added two new example folders: 1. custom-components/ - Shows how to implement custom React components - CustomButton.tsx - Flexible button with variants and theming - CustomDataGrid.tsx - Advanced grid with sorting, filtering, pagination - Component registration system 2. react-renderer/ - Shows how to render UI metadata with React - PageRenderer - Renders Page metadata - ComponentRenderer - Renders individual components - Template expression resolver for data binding - SimpleApp example showing complete integration Both examples include detailed READMEs with usage instructions Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b67fd23 commit 22d235e

File tree

16 files changed

+1835
-11
lines changed

16 files changed

+1835
-11
lines changed

examples/ui/README.md

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ This directory contains comprehensive examples demonstrating the **UI Protocol**
44

55
## 📚 What's Inside
66

7-
This example package demonstrates all major UI components of the ObjectStack Protocol:
7+
This package contains three types of examples:
8+
9+
1. **Metadata Examples** (`src/*.examples.ts`) - JSON/TypeScript configurations defining UI structure
10+
2. **Custom Components** (`custom-components/`) - React implementations of custom UI components
11+
3. **React Renderer** (`react-renderer/`) - How to render UI metadata using React
12+
13+
### Metadata Examples (`src/`)
14+
15+
These demonstrate all major UI components of the ObjectStack Protocol:
816

917
### 1. **Views** (`view.examples.ts`)
1018
Different ways to display and interact with data:
@@ -261,18 +269,70 @@ navigation: [
261269

262270
```
263271
examples/ui/
264-
├── package.json # Package configuration
265-
├── tsconfig.json # TypeScript configuration
266-
├── README.md # This file
267-
└── src/
268-
├── view.examples.ts # List, Form, Kanban, Calendar views
269-
├── page.examples.ts # Record, Home, App pages
270-
├── dashboard.examples.ts # Widgets and analytics
271-
├── action.examples.ts # Buttons and interactions
272-
├── app.examples.ts # Application structure
273-
└── theme.examples.ts # Visual styling
272+
├── package.json # Package configuration
273+
├── tsconfig.json # TypeScript configuration
274+
├── README.md # This file
275+
├── src/ # Metadata examples (JSON/TypeScript)
276+
│ ├── view.examples.ts # List, Form, Kanban, Calendar views
277+
│ ├── page.examples.ts # Record, Home, App pages
278+
│ ├── dashboard.examples.ts # Widgets and analytics
279+
│ ├── action.examples.ts # Buttons and interactions
280+
│ ├── app.examples.ts # Application structure
281+
│ └── theme.examples.ts # Visual styling
282+
├── custom-components/ # React component implementations
283+
│ ├── README.md
284+
│ ├── src/
285+
│ │ ├── components/
286+
│ │ │ ├── CustomButton.tsx
287+
│ │ │ └── CustomDataGrid.tsx
288+
│ │ └── registry.ts # Component registration
289+
│ └── package.json
290+
└── react-renderer/ # React renderer for metadata
291+
├── README.md
292+
├── src/
293+
│ ├── renderers/
294+
│ │ ├── PageRenderer.tsx
295+
│ │ └── ComponentRenderer.tsx
296+
│ ├── utils/
297+
│ │ └── templateResolver.ts
298+
│ └── examples/
299+
│ └── SimpleApp.tsx
300+
└── package.json
301+
```
302+
303+
## 🚀 Quick Start
304+
305+
### 1. View Metadata Examples
306+
307+
The TypeScript examples in `src/` show the metadata structure:
308+
309+
```bash
310+
# These are TypeScript files that demonstrate the protocol
311+
cat src/view.examples.ts
312+
cat src/app.examples.ts
313+
```
314+
315+
### 2. Custom Components
316+
317+
See how to implement custom React components:
318+
319+
```bash
320+
cd custom-components
321+
npm install
322+
npm run dev
323+
```
324+
325+
### 3. React Renderer
326+
327+
See how to render metadata with React:
328+
329+
```bash
330+
cd react-renderer
331+
npm install
332+
npm run dev
274333
```
275334

335+
276336
## 🤝 Related Examples
277337

278338
- **`examples/crm`**: Full CRM application using these UI patterns

0 commit comments

Comments
 (0)