Skip to content

Commit 28141ce

Browse files
committed
Add and restructure component documentation
Introduces detailed documentation for all component categories under docs/components, including new markdown files for basic, charts, data-display, feedback, form, kanban, layout, markdown, navigation, and overlay components. Updates the VitePress config to organize the sidebar and navigation for the new structure. Refactors the API docs to reference new component docs. Enhances the input renderer to support more props and validation. Updates type definitions for TableSchema (footer), CardSchema (body/children), and ResizableSchema (minHeight, withHandle).
1 parent 71fdfa3 commit 28141ce

File tree

16 files changed

+998
-486
lines changed

16 files changed

+998
-486
lines changed

docs/.vitepress/config.mts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineConfig({
1414

1515
nav: [
1616
{ text: 'Guide', link: '/guide/introduction' },
17-
{ text: 'Components', link: '/components/form' },
17+
{ text: 'Components', link: '/components/' },
1818
{
1919
text: 'Reference',
2020
items: [
@@ -118,11 +118,41 @@ export default defineConfig({
118118

119119
'/components/': [
120120
{
121-
text: 'Component Examples',
121+
text: 'Overview',
122122
items: [
123-
{ text: 'Form Component', link: '/components/form' },
123+
{ text: 'Component Index', link: '/components/' }
124+
]
125+
},
126+
{
127+
text: 'General',
128+
items: [
129+
{ text: 'Basic Components', link: '/components/basic' },
130+
{ text: 'Layout Components', link: '/components/layout' }
131+
]
132+
},
133+
{
134+
text: 'Data Entry',
135+
items: [
136+
{ text: 'Form Components', link: '/components/form' }
137+
]
138+
},
139+
{
140+
text: 'Data Display',
141+
items: [
142+
{ text: 'Data Display', link: '/components/data-display' },
143+
{ text: 'Charts', link: '/components/charts' },
144+
{ text: 'Kanban', link: '/components/kanban' },
124145
{ text: 'Calendar View', link: '/components/calendar-view' }
125146
]
147+
},
148+
{
149+
text: 'Interaction',
150+
items: [
151+
{ text: 'Navigation', link: '/components/navigation' },
152+
{ text: 'Feedback', link: '/components/feedback' },
153+
{ text: 'Overlay', link: '/components/overlay' },
154+
{ text: 'Markdown', link: '/components/markdown' }
155+
]
126156
}
127157
],
128158

docs/api/components.md

Lines changed: 13 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -18,98 +18,20 @@ import { registerDefaultRenderers } from '@object-ui/components'
1818
registerDefaultRenderers()
1919
```
2020

21-
Or register individual components:
21+
## Component Reference
2222

23-
```tsx
24-
import { Button, Input, Form } from '@object-ui/components'
25-
import { registerRenderer } from '@object-ui/react'
26-
27-
registerRenderer('button', Button)
28-
registerRenderer('input', Input)
29-
registerRenderer('form', Form)
30-
```
31-
32-
## Component List
33-
34-
### Form Components
35-
36-
- `input` - Text input field
37-
- `textarea` - Multi-line text input
38-
- `select` - Dropdown select
39-
- `checkbox` - Checkbox input
40-
- `radio` - Radio button
41-
- `date-picker` - Date selection
42-
- `file-upload` - File upload
43-
44-
### Data Display
45-
46-
- `table` - Data table with sorting/pagination
47-
- `list` - List view
48-
- `card` - Card container
49-
- `tree` - Tree view
50-
51-
### Layout
52-
53-
- `grid` - Grid layout
54-
- `flex` - Flexbox layout
55-
- `container` - Container wrapper
56-
- `tabs` - Tab navigation
57-
58-
### Feedback
59-
60-
- `alert` - Alert messages
61-
- `toast` - Toast notifications
62-
- `dialog` - Modal dialog
63-
- `loading` - Loading indicators
64-
65-
## Customization
66-
67-
### Styling
68-
69-
All components accept Tailwind classes:
70-
71-
```json
72-
{
73-
"type": "button",
74-
"className": "bg-blue-500 hover:bg-blue-700 text-white"
75-
}
76-
```
77-
78-
### Extending Components
79-
80-
Create custom components:
81-
82-
```tsx
83-
import { Button } from '@object-ui/components'
84-
85-
function CustomButton(props) {
86-
return (
87-
<Button
88-
{...props}
89-
className={`custom-styles ${props.className}`}
90-
/>
91-
)
92-
}
93-
94-
registerRenderer('custom-button', CustomButton)
95-
```
96-
97-
## Theming
98-
99-
Apply themes to all components:
100-
101-
```tsx
102-
import { ThemeProvider } from '@object-ui/components'
103-
104-
<ThemeProvider theme="dark">
105-
<SchemaRenderer schema={schema} />
106-
</ThemeProvider>
107-
```
23+
Detailed documentation for each component category:
10824

109-
## API Reference
25+
* [Layout Components](../components/layout.md) (Grid, Card, Container, etc.)
26+
* [Basic Components](../components/basic.md) (Text, Image, Icon, HTML)
27+
* [Form Components](../components/form.md) (Input, Select, Checkbox, Form, etc.)
28+
* [Data Display](../components/data-display.md) (Table, List, Tag, Tree, etc.)
29+
* [Navigation](../components/navigation.md) (Button, Link, Menu, etc.)
30+
* [Feedback](../components/feedback.md) (Alert, Progress, Toast, etc.)
31+
* [Overlay](../components/overlay.md) (Dialog, Drawer, Tooltip, etc.)
11032

111-
Full component API documentation coming soon.
33+
## Plugins
11234

113-
For now, see:
114-
- [GitHub Repository](https://github.com/objectql/objectui/tree/main/packages/components)
115-
- [Storybook](https://storybook.objectui.org) (coming soon)
35+
* [Charts](../components/charts.md) (Bar, Line, Pie, etc.)
36+
* [Kanban](../components/kanban.md) (Board View)
37+
* [Markdown](../components/markdown.md) (Rich Text)

docs/components/basic.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Basic Components
2+
3+
Fundamental UI elements for displaying simple content.
4+
5+
## Text `text`
6+
7+
Displays text with standardized typography styles.
8+
9+
```typescript
10+
interface TextSchema {
11+
type: 'text';
12+
value: string;
13+
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'lead' | 'large' | 'small' | 'muted';
14+
align?: 'left' | 'center' | 'right' | 'justify';
15+
color?: string; // Text color class
16+
}
17+
```
18+
19+
## Html `html`
20+
21+
Render raw HTML content safely.
22+
23+
```typescript
24+
interface HtmlSchema {
25+
type: 'html';
26+
html: string; // The HTML string to render
27+
}
28+
```
29+
30+
## Image `image`
31+
32+
Displays an image with optional fallback.
33+
34+
```typescript
35+
interface ImageSchema {
36+
type: 'image';
37+
src: string;
38+
alt?: string;
39+
width?: number | string;
40+
height?: number | string;
41+
fallback?: string; // URL for fallback image
42+
fit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
43+
}
44+
```
45+
46+
## Icon `icon`
47+
48+
Displays an icon from the Lucide library.
49+
50+
```typescript
51+
interface IconSchema {
52+
type: 'icon';
53+
name: string; // Lucide icon name (kebab-case)
54+
size?: number | 'sm' | 'md' | 'lg' | 'xl';
55+
color?: string;
56+
}
57+
```

docs/components/charts.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Chart Components
2+
3+
Visualizations for data analytics.
4+
5+
## Bar Chart `bar-chart`
6+
7+
Vertical or horizontal bar chart.
8+
9+
```typescript
10+
interface BarChartSchema {
11+
type: 'bar-chart';
12+
data: any[]; // Or bound via context
13+
categories: string[]; // Fields to plot as bars (e.g. ["sales", "profit"])
14+
index: string; // Field for X-axis (e.g. "month")
15+
colors?: string[]; // Array of color codes or CSS variables
16+
valueFormatter?: string; // Function name to format values
17+
yAxisWidth?: number;
18+
layout?: 'vertical' | 'horizontal';
19+
stack?: boolean; // Stacked bars
20+
}
21+
```
22+
23+
## Line Chart `line-chart`
24+
25+
Line chart for trends over time.
26+
27+
```typescript
28+
interface LineChartSchema {
29+
type: 'line-chart';
30+
data: any[];
31+
categories: string[];
32+
index: string;
33+
colors?: string[];
34+
valueFormatter?: string;
35+
yAxisWidth?: number;
36+
curveType?: 'monotone' | 'linear' | 'step'; // Curve interpolation
37+
}
38+
```
39+
40+
## Pie Chart `pie-chart`
41+
42+
Circular chart for part-to-whole comparison.
43+
44+
```typescript
45+
interface PieChartSchema {
46+
type: 'pie-chart';
47+
data: any[];
48+
category: string; // Field for segment names
49+
value: string; // Field for segment values
50+
colors?: string[];
51+
valueFormatter?: string;
52+
donut?: boolean; // Donut style
53+
}
54+
```
55+
56+
## Area Chart `area-chart`
57+
58+
Area chart for filled trends.
59+
60+
```typescript
61+
interface AreaChartSchema {
62+
type: 'area-chart';
63+
data: any[];
64+
categories: string[];
65+
index: string;
66+
colors?: string[];
67+
stack?: boolean;
68+
}
69+
```

0 commit comments

Comments
 (0)