|
2 | 2 |
|
3 | 3 | <div align="center"> |
4 | 4 |
|
5 | | -**The Modular Interface Engine for the Enterprise.** |
| 5 | + **The Universal, Headless, Schema-Driven Rendering Engine.** |
| 6 | + |
| 7 | + Build complex Enterprise UIs with JSON. Styled with Tailwind CSS & Shadcn UI. |
6 | 8 |
|
7 | | -A high-performance, schema-driven UI system built on **React 18**, **Tailwind CSS**, and **Shadcn UI**. |
8 | | - |
9 | | -[](https://github.com/objectql/objectui/actions/workflows/ci.yml) |
10 | | -[](https://opensource.org/licenses/MIT) |
11 | | - |
12 | | -[Documentation](https://www.objectui.org) · [Playground](https://www.objectui.org/playground) · [Report Bug](https://github.com/objectql/objectui/issues) |
| 9 | + [](LICENSE) |
| 10 | + [](https://www.typescriptlang.org/) |
| 11 | + [](https://www.npmjs.com/package/@object-ui/react) |
13 | 12 |
|
14 | 13 | </div> |
15 | 14 |
|
16 | 15 | --- |
17 | 16 |
|
18 | 17 | ## 📖 Introduction |
19 | 18 |
|
20 | | -**Object UI** is a collection of libraries designed to transform data objects into intelligent user interfaces. It is the official presentation layer of the **ObjectQL** ecosystem, working in harmony with [ObjectQL](https://github.com/objectql/objectql) and [ObjectOS](https://github.com/objectql/objectos). |
21 | | - |
22 | | -Unlike monolithic low-code frameworks, Object UI is built as a **modular ecosystem** under the `@object-ui` scope. You can use the core engine, the component library, or the visual designer independently or together. |
23 | | - |
24 | | -## 📦 Ecosystem & Packages |
25 | | - |
26 | | -Object UI is organized into several distinct packages, each serving a specific purpose: |
27 | | - |
28 | | -| Package | NPM Name | Description | |
29 | | -| --- | --- | --- | |
30 | | -| **Core** | [`@object-ui/core`](./packages/core) | **The Brain.** Schema definitions, renderer registry, and logic. No UI dependencies. | |
31 | | -| **React** | [`@object-ui/react`](./packages/react) | **The Glue.** React context, hooks, and the main `<SchemaRenderer />` component. | |
32 | | -| **Components** | [`@object-ui/components`](./packages/components) | **The Look.** A set of high-quality UI renderers built with Tailwind CSS & Shadcn. | |
33 | | -| **Designer** | [`@object-ui/designer`](./packages/designer) | **The Tool.** A drag-and-drop visual editor to generate Object UI schemas. | |
34 | | - |
35 | | -## 🏗 Architecture |
| 19 | +**Object UI** is a high-performance rendering engine for React. It transforms **JSON/YAML Schemas** into modern, responsive user interfaces. |
36 | 20 |
|
37 | | -The architecture is designed for **maximum flexibility** and **zero bloat**. |
| 21 | +Unlike traditional low-code libraries (like Amis or RJSF) that ship with heavy, opinionated CSS, Object UI is **Tailwind-Native**. Every component is built using **Shadcn UI** primitives and utility classes, giving you complete control over the design system. |
38 | 22 |
|
39 | | -```mermaid |
40 | | -graph TD |
41 | | - A[JSON Schema] -->|Parses| B(@object-ui/core) |
42 | | - B -->|Provides Context| C(@object-ui/react) |
43 | | - C -->|Renders| D(@object-ui/components) |
44 | | - D -->|Uses| E[Tailwind CSS] |
45 | | - D -->|Uses| F[Shadcn/Radix UI] |
| 23 | +**Why Object UI?** |
| 24 | +* 🎨 **Tailwind Native:** No black-box styles. Override anything with `className`. |
| 25 | +* 🔌 **Protocol Agnostic:** Works with **ObjectQL**, any **REST API**, or just **Static JSON**. |
| 26 | +* ⚛️ **React First:** Built with React 18, Hooks, and modern Context patterns. |
| 27 | +* 📱 **Responsive:** Enterprise-grade layouts (Grid, Kanban, Dashboard) out of the box. |
46 | 28 |
|
47 | | -``` |
48 | | - |
49 | | -* **Decoupled Logic:** The `core` package handles schema validation and logic, meaning you could theoretically write a Vue or Svelte adapter in the future. |
50 | | -* **Tailwind Native:** Styles are not hardcoded. Override anything using utility classes in your schema. |
51 | | -* **Tree-Shakable:** If you only use the `Input` and `Button` components, your bundle won't include the heavy `DataGrid`. |
52 | | - |
53 | | -## 🚀 Quick Start |
| 29 | +--- |
54 | 30 |
|
55 | | -To use Object UI in your React project, install the core and component packages. |
| 31 | +## 📦 Installation |
56 | 32 |
|
57 | | -### 1. Installation |
| 33 | +Object UI is modular. Install the React core and the standard component set: |
58 | 34 |
|
59 | 35 | ```bash |
60 | 36 | npm install @object-ui/react @object-ui/components |
61 | 37 | # or |
62 | | -yarn add @object-ui/react @object-ui/components |
| 38 | +pnpm add @object-ui/react @object-ui/components |
63 | 39 |
|
64 | 40 | ``` |
65 | 41 |
|
66 | | -### 2. Basic Usage |
| 42 | +> **Note:** You also need `tailwindcss` and `lucide-react` installed in your project. |
| 43 | +
|
| 44 | +--- |
| 45 | + |
| 46 | +## ⚡ Quick Start |
67 | 47 |
|
68 | | -Define a schema and render it using the `SchemaRenderer`. |
| 48 | +### 1. Define your Schema |
| 49 | + |
| 50 | +You can define your UI structure using a simple JSON object. |
69 | 51 |
|
70 | 52 | ```tsx |
71 | | -import React from 'react'; |
72 | | -import { SchemaRenderer } from '@object-ui/react'; |
73 | | -import { Form, Input, Button } from '@object-ui/components'; // Register default components |
74 | | - |
75 | | -// 1. Register the components you want to use (or register all globally) |
76 | | -import { registerRenderers } from '@object-ui/core'; |
77 | | -registerRenderers({ |
78 | | - 'form': Form, |
79 | | - 'input': Input, |
80 | | - 'button': Button |
81 | | -}); |
| 53 | +// schema.ts |
| 54 | +import { PageSchema } from '@object-ui/types'; |
82 | 55 |
|
83 | | -// 2. Define your Schema |
84 | | -const schema = { |
85 | | - type: "form", |
86 | | - className: "space-y-4 p-6 border rounded-lg", |
| 56 | +export const myPageSchema: PageSchema = { |
| 57 | + type: 'page', |
| 58 | + title: 'User Profile', |
87 | 59 | body: [ |
88 | 60 | { |
89 | | - type: "input", |
90 | | - name: "username", |
91 | | - label: "Username", |
92 | | - required: true |
| 61 | + type: 'grid', |
| 62 | + columns: 2, |
| 63 | + children: [ |
| 64 | + { |
| 65 | + type: 'input', |
| 66 | + name: 'first_name', |
| 67 | + label: 'First Name', |
| 68 | + required: true |
| 69 | + }, |
| 70 | + { |
| 71 | + type: 'input', |
| 72 | + name: 'email', |
| 73 | + label: 'Email', |
| 74 | + className: 'bg-slate-50' // Tailwind classes work here! |
| 75 | + } |
| 76 | + ] |
93 | 77 | }, |
94 | 78 | { |
95 | | - type: "button", |
96 | | - label: "Submit", |
97 | | - level: "primary" |
| 79 | + type: 'button', |
| 80 | + label: 'Save Changes', |
| 81 | + level: 'primary', |
| 82 | + actionType: 'submit', |
| 83 | + className: 'mt-4' |
98 | 84 | } |
99 | 85 | ] |
100 | 86 | }; |
101 | 87 |
|
102 | | -// 3. Render |
| 88 | +``` |
| 89 | + |
| 90 | +### 2. Render it! |
| 91 | + |
| 92 | +Use the `<SchemaRenderer />` component to bring it to life. |
| 93 | + |
| 94 | +```tsx |
| 95 | +import React from 'react'; |
| 96 | +import { SchemaRenderer } from '@object-ui/react'; |
| 97 | +import { standardComponents } from '@object-ui/components'; |
| 98 | +import { myPageSchema } from './schema'; |
| 99 | + |
103 | 100 | export default function App() { |
104 | | - return <SchemaRenderer schema={schema} />; |
| 101 | + const handleAction = (action, data) => { |
| 102 | + console.log('User clicked:', action, 'Data:', data); |
| 103 | + }; |
| 104 | + |
| 105 | + return ( |
| 106 | + <div className="p-8 max-w-4xl mx-auto"> |
| 107 | + <SchemaRenderer |
| 108 | + schema={myPageSchema} |
| 109 | + components={standardComponents} |
| 110 | + onAction={handleAction} |
| 111 | + /> |
| 112 | + </div> |
| 113 | + ); |
105 | 114 | } |
106 | 115 |
|
107 | 116 | ``` |
108 | 117 |
|
109 | | -## 🛠 Developing |
| 118 | +--- |
| 119 | + |
| 120 | +## 🔌 Universal Data Source (Protocol Agnostic) |
110 | 121 |
|
111 | | -This project is a Monorepo managed by **TurboRepo** and **pnpm**. |
| 122 | +Object UI is not tied to any specific backend. You can use it with **any** data source. |
112 | 123 |
|
113 | | -### Prerequisites |
| 124 | +### Option A: Static / Uncontrolled |
114 | 125 |
|
115 | | -* Node.js 18+ |
116 | | -* pnpm 10+ |
| 126 | +Use it as a pure controlled component for forms. |
117 | 127 |
|
118 | | -### Setup |
| 128 | +```tsx |
| 129 | +<SchemaRenderer |
| 130 | + schema={formSchema} |
| 131 | + value={formData} |
| 132 | + onChange={setFormData} |
| 133 | +/> |
119 | 134 |
|
120 | | -```bash |
121 | | -# 1. Clone the repository |
122 | | -git clone https://github.com/objectql/objectui.git |
| 135 | +``` |
123 | 136 |
|
124 | | -# 2. Install dependencies |
125 | | -pnpm install |
| 137 | +### Option B: Generic REST API |
126 | 138 |
|
127 | | -# 3. Start the development playground |
128 | | -pnpm dev |
| 139 | +Connect to any API using a `DataSource` adapter. |
129 | 140 |
|
130 | | -``` |
| 141 | +```tsx |
| 142 | +import { RestDataSource } from '@object-ui/data-rest'; |
| 143 | + |
| 144 | +const api = new RestDataSource({ |
| 145 | + baseUrl: '[https://api.example.com/v1](https://api.example.com/v1)', |
| 146 | + headers: { Authorization: 'Bearer ...' } |
| 147 | +}); |
131 | 148 |
|
132 | | -### Testing |
| 149 | +<SchemaRenderer |
| 150 | + schema={pageSchema} |
| 151 | + dataSource={api} // The components will fetch data automatically |
| 152 | +/> |
133 | 153 |
|
134 | | -We use **Vitest** for testing. All tests are located in `__tests__` directories within each package. |
| 154 | +``` |
135 | 155 |
|
136 | | -```bash |
137 | | -# Run all tests |
138 | | -pnpm test |
| 156 | +### Option C: ObjectQL (The Perfect Match) |
139 | 157 |
|
140 | | -# Run tests in watch mode |
141 | | -pnpm test:watch |
| 158 | +If you use **ObjectQL**, Object UI provides zero-config integration. |
142 | 159 |
|
143 | | -# Run tests with UI |
144 | | -pnpm test:ui |
| 160 | +```tsx |
| 161 | +import { ObjectQLDataSource } from '@object-ui/data-objectql'; |
145 | 162 |
|
146 | | -# Generate coverage report |
147 | | -pnpm test:coverage |
| 163 | +<SchemaRenderer |
| 164 | + schema={pageSchema} |
| 165 | + dataSource={new ObjectQLDataSource()} |
| 166 | +/> |
148 | 167 |
|
149 | 168 | ``` |
150 | 169 |
|
151 | | -### Building |
| 170 | +--- |
152 | 171 |
|
153 | | -```bash |
154 | | -# Build all packages |
155 | | -pnpm build |
| 172 | +## 🧩 Architecture |
156 | 173 |
|
157 | | -# Lint all packages |
158 | | -pnpm lint |
| 174 | +This project is organized as a Monorepo: |
159 | 175 |
|
160 | | -``` |
| 176 | +| Package | Description | |
| 177 | +| --- | --- | |
| 178 | +| **`@object-ui/types`** | The protocol definitions. Pure TypeScript interfaces. | |
| 179 | +| **`@object-ui/core`** | The logic engine. Data scoping, validation, evaluation. | |
| 180 | +| **`@object-ui/react`** | The React framework adapter. | |
| 181 | +| **`@object-ui/components`** | The standard UI library implementation (Shadcn + Tailwind). | |
| 182 | +| **`@object-ui/plugin-*`** | Lazy-loaded complex components (e.g., AG Grid, Monaco). | |
161 | 183 |
|
162 | | -## 🤝 Contributing |
| 184 | +--- |
| 185 | + |
| 186 | +## 🤝 Comparison |
163 | 187 |
|
164 | | -We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. |
| 188 | +| Feature | Object UI | Amis / Lowcode Engine | Formily / RJSF | |
| 189 | +| --- | --- | --- | --- | |
| 190 | +| **Styling** | **Tailwind Native** (Utility) | Opinionated CSS (Hard to override) | Various (AntD/MUI wrappers) | |
| 191 | +| **Scope** | **Full Pages** & Apps | Full Pages & Apps | Mostly Forms | |
| 192 | +| **Protocol** | **JSON Schema** | Custom JSON | JSON Schema / Internal | |
| 193 | +| **Dependencies** | Light (Radix UI) | Heavy (Bootstrap/JQuery legacy) | Medium | |
| 194 | +| **Backend** | **Agnostic** | Tightly coupled (Amis) | Agnostic | |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## 🛤️ Roadmap |
| 199 | + |
| 200 | +* [ ] **Visual Designer:** Drag-and-drop schema builder. |
| 201 | +* [ ] **Plugin Ecosystem:** Support for AG Grid Enterprise, ECharts, and Monaco Editor. |
| 202 | +* [ ] **SSR Support:** Full compatibility with Next.js App Router. |
165 | 203 |
|
166 | 204 | ## 📄 License |
167 | 205 |
|
168 | | -This project is licensed under the MIT License. |
| 206 | +Licensed under the [MIT License](https://www.google.com/search?q=LICENSE). |
| 207 | + |
| 208 | +--- |
| 209 | + |
| 210 | +<div align="center"> |
| 211 | +<sub>Built with ❤️ by the Object Ecosystem Team.</sub> |
| 212 | +</div> |
| 213 | + |
| 214 | +``` |
0 commit comments