Skip to content

Commit dfdce4d

Browse files
authored
Merge pull request #11 from objectstack-ai/copilot/initialize-document-directory
2 parents 7d6a961 + aa79a8d commit dfdce4d

File tree

7 files changed

+1001
-0
lines changed

7 files changed

+1001
-0
lines changed

content/docs/components/meta.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"title": "Components",
3+
"pages": [
4+
"objectui-embed"
5+
]
6+
}
Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
---
2+
title: ObjectUI Embed
3+
description: Learn how to embed interactive ObjectUI components directly in your documentation.
4+
---
5+
6+
import { Cpu, Code, Layout } from 'lucide-react';
7+
8+
# ObjectUI Embed
9+
10+
One of ObjectDocs' most powerful features is the ability to embed live, interactive **ObjectUI** components directly within your Markdown documentation.
11+
12+
## Overview
13+
14+
ObjectUI is a low-code component library that renders interactive interfaces from JSON schemas. By embedding these components in your docs, you can:
15+
16+
* **Demonstrate Live Examples**: Show working examples without screenshots
17+
* **Interactive Tutorials**: Let users interact with components as they learn
18+
* **Configuration Visualization**: Display how JSON schemas render as UI
19+
20+
<Callout type="info">
21+
ObjectUI integration allows you to showcase your low-code platform capabilities directly in the documentation, making it easier for users to understand how configurations translate to visual components.
22+
</Callout>
23+
24+
## Basic Usage
25+
26+
### JSON Schema Format
27+
28+
ObjectUI components are defined using JSON schemas that describe the component type, properties, and behavior:
29+
30+
```json
31+
{
32+
"component": "ObjectGrid",
33+
"props": {
34+
"object": "contracts",
35+
"columns": ["name", "amount", "status", "created_by"],
36+
"filters": [
37+
{ "field": "status", "operator": "=", "value": "active" }
38+
]
39+
}
40+
}
41+
```
42+
43+
### Component Types
44+
45+
<Cards>
46+
<Card icon={<Layout />} title="ObjectGrid">
47+
Display data in a customizable table with sorting, filtering, and pagination
48+
</Card>
49+
<Card icon={<Code />} title="ObjectForm">
50+
Render forms with validation based on object schema definitions
51+
</Card>
52+
<Card icon={<Cpu />} title="ObjectDetail">
53+
Show detailed view of a single record with related data
54+
</Card>
55+
</Cards>
56+
57+
## Example: Object Grid
58+
59+
Here's how to embed a data grid showing contract information:
60+
61+
```json title="contract-grid.json"
62+
{
63+
"component": "ObjectGrid",
64+
"props": {
65+
"object": "contracts",
66+
"columns": [
67+
{ "field": "name", "label": "Contract Name" },
68+
{ "field": "amount", "label": "Amount", "type": "currency" },
69+
{ "field": "status", "label": "Status", "type": "badge" },
70+
{ "field": "created_by", "label": "Created By" }
71+
],
72+
"filters": [
73+
{
74+
"field": "status",
75+
"operator": "in",
76+
"value": ["active", "pending"]
77+
}
78+
],
79+
"sort": {
80+
"field": "created_at",
81+
"order": "desc"
82+
},
83+
"pageSize": 10,
84+
"searchable": true
85+
}
86+
}
87+
```
88+
89+
This configuration will render an interactive grid with:
90+
* Four visible columns (name, amount, status, creator)
91+
* Filtering for active and pending contracts
92+
* Sorting by creation date (newest first)
93+
* Search functionality
94+
* Pagination with 10 items per page
95+
96+
## Example: Object Form
97+
98+
Create an embedded form for data entry:
99+
100+
```json title="contract-form.json"
101+
{
102+
"component": "ObjectForm",
103+
"props": {
104+
"object": "contracts",
105+
"mode": "create",
106+
"fields": [
107+
{
108+
"field": "name",
109+
"label": "Contract Name",
110+
"required": true,
111+
"placeholder": "Enter contract name"
112+
},
113+
{
114+
"field": "amount",
115+
"label": "Contract Amount",
116+
"type": "number",
117+
"required": true,
118+
"min": 0
119+
},
120+
{
121+
"field": "status",
122+
"label": "Status",
123+
"type": "select",
124+
"options": [
125+
{ "label": "Draft", "value": "draft" },
126+
{ "label": "Active", "value": "active" },
127+
{ "label": "Completed", "value": "completed" }
128+
],
129+
"default": "draft"
130+
},
131+
{
132+
"field": "description",
133+
"label": "Description",
134+
"type": "textarea",
135+
"rows": 4
136+
}
137+
],
138+
"submitButton": {
139+
"text": "Create Contract",
140+
"color": "primary"
141+
}
142+
}
143+
}
144+
```
145+
146+
## Schema Validation
147+
148+
ObjectUI components automatically validate against the object schema defined in your ObjectQL configuration. This ensures:
149+
150+
* Type safety
151+
* Required field validation
152+
* Format validation (email, URL, etc.)
153+
* Custom business rules
154+
155+
<Callout type="warn">
156+
Make sure your object schemas are properly defined in ObjectQL before embedding ObjectUI components. Missing schema definitions will result in validation errors.
157+
</Callout>
158+
159+
## Advanced Features
160+
161+
### Conditional Rendering
162+
163+
Show/hide fields based on other field values:
164+
165+
```json
166+
{
167+
"component": "ObjectForm",
168+
"props": {
169+
"object": "contracts",
170+
"fields": [
171+
{
172+
"field": "type",
173+
"type": "select",
174+
"options": ["fixed", "hourly"]
175+
},
176+
{
177+
"field": "fixed_amount",
178+
"type": "number",
179+
"visible": {
180+
"conditions": [
181+
{ "field": "type", "operator": "=", "value": "fixed" }
182+
]
183+
}
184+
},
185+
{
186+
"field": "hourly_rate",
187+
"type": "number",
188+
"visible": {
189+
"conditions": [
190+
{ "field": "type", "operator": "=", "value": "hourly" }
191+
]
192+
}
193+
}
194+
]
195+
}
196+
}
197+
```
198+
199+
### Related Objects
200+
201+
Display related data using lookups:
202+
203+
```json
204+
{
205+
"component": "ObjectGrid",
206+
"props": {
207+
"object": "contracts",
208+
"columns": [
209+
"name",
210+
{
211+
"field": "customer",
212+
"type": "lookup",
213+
"related": "customers",
214+
"displayField": "company_name"
215+
},
216+
{
217+
"field": "owner",
218+
"type": "lookup",
219+
"related": "users",
220+
"displayField": "full_name"
221+
}
222+
]
223+
}
224+
}
225+
```
226+
227+
### Custom Actions
228+
229+
Add custom buttons and actions:
230+
231+
```json
232+
{
233+
"component": "ObjectGrid",
234+
"props": {
235+
"object": "contracts",
236+
"actions": [
237+
{
238+
"label": "Approve",
239+
"icon": "check",
240+
"color": "success",
241+
"onClick": "approve_contract",
242+
"visible": {
243+
"conditions": [
244+
{ "field": "status", "operator": "=", "value": "pending" }
245+
]
246+
}
247+
},
248+
{
249+
"label": "Reject",
250+
"icon": "x",
251+
"color": "danger",
252+
"onClick": "reject_contract"
253+
}
254+
]
255+
}
256+
}
257+
```
258+
259+
## Best Practices
260+
261+
<Steps>
262+
### Keep Examples Simple
263+
264+
Start with basic configurations and gradually introduce complexity. Users should be able to understand the example at a glance.
265+
266+
### Provide Real Data
267+
268+
Use realistic sample data that demonstrates actual use cases rather than generic "test" data.
269+
270+
### Document All Props
271+
272+
Always explain what each property does, especially for complex configurations.
273+
274+
### Test Interactivity
275+
276+
Before publishing, interact with embedded components to ensure they work as expected.
277+
</Steps>
278+
279+
## Integration with Steedos
280+
281+
ObjectUI seamlessly integrates with **Steedos** metadata, allowing you to:
282+
283+
* Reference existing object definitions
284+
* Use Steedos permissions and validation rules
285+
* Trigger Steedos workflows
286+
* Connect to live Steedos data sources
287+
288+
```json
289+
{
290+
"component": "ObjectGrid",
291+
"props": {
292+
"object": "contracts",
293+
"dataSource": "steedos",
294+
"endpoint": "https://api.steedos.com/api/v4",
295+
"filters": [
296+
{
297+
"field": "space",
298+
"operator": "=",
299+
"value": "${current_space_id}"
300+
}
301+
]
302+
}
303+
}
304+
```
305+
306+
## Limitations
307+
308+
<Callout type="warn">
309+
**Current Limitations:**
310+
311+
* ObjectUI components require ObjectQL schema definitions
312+
* Some advanced features may require Steedos backend
313+
* Real-time updates need websocket configuration
314+
* File uploads require storage configuration
315+
</Callout>
316+
317+
## Next Steps
318+
319+
<Cards>
320+
<Card title="Configuration" href="/docs/getting-started/configuration">
321+
Learn more about configuring ObjectDocs
322+
</Card>
323+
<Card title="Architecture" href="/docs/getting-started/architecture">
324+
Understand the underlying architecture
325+
</Card>
326+
</Cards>

0 commit comments

Comments
 (0)