mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 14:14:57 +00:00
JSON UI Examples
This directory contains example JSON configurations that demonstrate the capabilities of the JSON UI system.
Available Examples
1. Dashboard (dashboard.json)
A complete dashboard interface featuring:
- Stats Cards: Display key metrics with data binding
- Activity Feed: Shows recent activities using list looping
- Quick Actions: Grid of action buttons with click handlers
- Static Data Sources: Demonstrates hardcoded data in JSON
Key Features Demonstrated:
- Component composition with Cards
- Data binding to show dynamic values
- Event handlers for user interactions
- Grid layouts with responsive classes
- Icon components integration
2. Form (form.json)
A user registration form showcasing:
- Text Inputs: Name, email, password fields
- Textarea: Multi-line bio input
- Checkbox: Newsletter subscription
- Form Actions: Submit and cancel buttons
- Data Binding: Two-way binding for all form fields
Key Features Demonstrated:
- Form field components
- Input validation attributes
- onChange event handling
- Form data management
- Label-input associations
3. Data Table (table.json)
An interactive projects table with:
- Table Structure: Header and body rows
- List Looping: Dynamic rows from array data
- Status Badges: Visual status indicators
- Row Actions: View, edit, and delete buttons per row
- Action Parameters: Pass row data to event handlers
Key Features Demonstrated:
- Table components (TableHeader, TableBody, TableRow, TableCell)
- Loop rendering with itemVar and indexVar
- Badge components for status
- Icon buttons for actions
- Event handlers with dynamic parameters
4. Settings (settings.json)
A comprehensive settings panel featuring:
- Tabbed Interface: General, Notifications, Security tabs
- Switch Toggles: Enable/disable features
- Select Dropdown: Language selection
- Multiple Data Sources: Separate sources for each tab
- Settings Persistence: Save and reset functionality
Key Features Demonstrated:
- Tabs component with multiple TabsContent
- Switch components with data binding
- Select components with options
- Separator components for visual organization
- Multiple independent data sources
5. List/Table/Timeline Bindings (list-table-timeline.json)
A binding-focused layout that highlights:
- List loops: ListItem rows rendered from a data source
- Data table bindings: Columns and rows bound to JSON data
- Timeline bindings: Timeline items pulled from a structured array
Key Features Demonstrated:
- Loop contexts with
itemVarandindexVar - Property bindings for component props
- Shared data sources across multiple components
How to Use These Examples
- View in the UI: Navigate to the "JSON UI" page in the application to see live previews
- Toggle JSON View: Click the "Show JSON" button to see the configuration
- Copy and Modify: Use these as templates for your own UI configurations
- Learn by Example: Each example builds on concepts from the previous ones
Creating Your Own
To create a new JSON UI:
- Create a new
.jsonfile in this directory - Follow the structure from existing examples
- Import it in
JSONUIShowcase.tsx:import myExample from '@/config/ui-examples/my-example.json' - Add it to the examples object:
myExample: { name: 'My Example', description: 'Description here', icon: IconComponent, config: myExample, }
JSON Structure Reference
Each JSON file should have:
id: Unique identifiertitle: Display titledescription: Brief descriptionlayout: Root layout configurationtype: Layout type (flex, grid, etc.)children: Array of child components
dataSources: Data sources configurationactions(optional): Action definitions
Best Practices
- Start Simple: Begin with basic layouts before adding complexity
- Use Semantic IDs: Give components meaningful, descriptive IDs
- Test Data First: Start with static data sources before moving to API/KV
- Incremental Development: Add features one at a time
- Refer to Documentation: See
/docs/JSON-UI-SYSTEM.mdfor complete reference
Tips
- Use the existing examples as starting points
- Keep component trees shallow for better performance
- Leverage Tailwind classes for styling
- Use data binding instead of hardcoded values
- Group related settings in separate data sources