Ignition Perspective UI Development Rules for AI Agents
๐ฏ Core Principles for AI-Generated UIsโ
When building Ignition Perspective interfaces, follow these empirically-validated rules based on analysis of 12,220+ production components.
๐ Essential Component Rulesโ
1. Component Structure Requirementsโ
{
"type": "ia.display.label", // REQUIRED: Must be valid ia.* type
"meta": {
"name": "ComponentName" // REQUIRED: Unique, descriptive name
},
"props": { /* component properties */ },
"position": { /* layout properties */ }
}
AI Guidelines:
- โ
Always include
typeandmeta.name - โ
Use descriptive, camelCase names (
TankLevelIndicator, notLabel1) - โ Never generate duplicate component names in the same view
2. Component Type Selectionโ
Most Common Production Patterns:
ia.container.flex (35%) - Use for all layout containers
ia.display.label (31%) - Use for text display
ia.display.icon (6%) - Use for status indicators
ia.input.button (5%) - Use for user actions
ia.display.view (6%) - Use for component composition
AI Decision Tree:
- Need layout? โ
ia.container.flex - Show text/values? โ
ia.display.label - User interaction? โ
ia.input.button - Status indicator? โ
ia.display.icon - Data visualization? โ
ia.chart.xyoria.chart.gauge
๐จ Layout and Positioning Rulesโ
3. Flexible Layout Propertiesโ
"position": {
"width": 200, // number (pixels) OR
"width": "50%", // string (percentage) OR
"width": ".5", // string (decimal ratio)
"grow": 1, // number (flex grow) OR
"grow": "Auto", // string (auto-sizing)
"shrink": 0 // number OR "Auto"
}
AI Guidelines:
- โ Use numbers for fixed pixel dimensions
- โ Use percentage strings for responsive layouts
- โ Use flex properties (grow/shrink) for dynamic sizing
- โ Mix units appropriately for responsive design
4. Container Hierarchyโ
Root View
โโโ ia.container.flex (direction: "column")
โ โโโ Header: ia.container.flex (direction: "row")
โ โโโ Content: ia.container.flex (grows to fill)
โ โโโ Footer: ia.container.flex (direction: "row")
AI Guidelines:
- โ
Always use
ia.container.flexas the root container - โ
Set
direction: "column"for vertical stacking - โ
Set
direction: "row"for horizontal layouts - โ Use nested containers for complex layouts
๐พ Data Binding and Eventsโ
5. Property Binding Patternsโ
"propConfig": {
"props.text": {
"binding": {
"type": "tag", // Production pattern
"config": {
"path": "[Tank01]Level"
}
}
}
}
AI Guidelines:
- โ
Use
tagbindings for real-time data - โ
Use
exprbindings for calculations - โ Always specify meaningful tag paths
- โ Don't hardcode dynamic values in
props
6. Event Handler Structureโ
"events": {
"component": {
"onActionPerformed": { // Single handler
"config": { "script": "..." },
"scope": "G",
"type": "script"
}
}
}
Or for multiple handlers:
"events": {
"component": {
"onActionPerformed": [ // Multiple handlers
{ "config": {...}, "type": "script" },
{ "config": {...}, "type": "navigation" }
]
}
}
๐ Quality and Performance Rulesโ
7. Accessibility Requirementsโ
"meta": {
"name": "TankLevelDisplay", // Descriptive name
"tooltip": {
"enabled": true,
"text": "Current tank level: 75%" // Meaningful description
}
}
AI Guidelines:
- โ Always provide descriptive component names
- โ Add tooltips for complex or data-bound components
- โ Use clear, human-readable text
- โ Don't use generic names like "Label1", "Button2"
8. Performance Optimizationโ
"props": {
"style": {
"classes": "tank-indicator" // Use CSS classes
}
}
AI Guidelines:
- โ Use CSS classes instead of inline styles when possible
- โ Limit deep nesting (max 5 levels)
- โ
Prefer
ia.display.viewfor reusable components - โ Don't duplicate identical component structures
๐จ Common AI Pitfalls to Avoidโ
CRITICAL: Ignition Indentation Requirementโ
# โ FATAL ERROR - Will fail in Ignition runtime
"script": "import json\nresponse = system.net.httpClient().post(url)"
# โ
CORRECT - All lines must have indentation
"script": "\timport json\n\tresponse = system.net.httpClient().post(url)"
๐จ IGNITION REQUIREMENT: ALL lines in inline scripts must start with at least 1 tab or 4 spaces. Scripts without proper indentation will cause syntax errors and component failures.
Type Safety Issuesโ
// โ Wrong
"props": {
"text": 525 // Should be string or null
}
// โ
Correct
"props": {
"text": "525" // String for display
}
Layout Problemsโ
// โ Wrong - Missing flex properties
"position": {
"width": 100,
"height": 50
}
// โ
Correct - Responsive flex layout
"position": {
"basis": "auto",
"grow": 1,
"shrink": 0
}
Event Handler Errorsโ
// โ Wrong - Invalid event structure
"events": {
"onClick": "doSomething()"
}
// โ
Correct - Proper event structure
"events": {
"component": {
"onActionPerformed": {
"config": {"script": "doSomething()"},
"scope": "G",
"type": "script"
}
}
}
๐งช Testing and Validationโ
9. Pre-Commit Validationโ
Before generating any UI, run:
./ignition-lint path/to/view.json --format=json --severity=error
AI Integration:
- Parse JSON output for
status: "issues_found" - Fix any
severity: "error"issues before proceeding - Consider
severity: "warning"suggestions for better UIs
10. Schema Compliance Checkโ
Ensure all components pass:
# Validate against empirical schema
results = linter.lint_file("my_view.json")
assert results["schema_compliance"]["valid"] == True
๐ Component-Specific Guidelinesโ
Charts and Visualizationโ
- Use
ia.chart.gaugefor single-value indicators - Use
ia.chart.xyfor time series data - Use
ia.chart.powerchartfor complex industrial data
Input Componentsโ
- Use
ia.input.buttonfor actions - Use
ia.input.toggle-switchfor boolean states - Use
ia.input.numeric-entry-fieldfor number inputs
Industrial Symbolsโ
- Use
ia.symbol.sensorfor sensor representations - Use
ia.symbol.valvefor valve controls - Use
ia.display.led-displayfor status indicators
๐ฏ AI Success Metricsโ
Your generated UIs should achieve:
- โ 100% schema validation (no errors)
- โ Zero accessibility issues (proper names/tooltips)
- โ Responsive layout (proper flex usage)
- โ Performance optimized (CSS classes, minimal nesting)
- โ Production patterns (follows empirical usage data)
Run ./ignition-lint after generation to verify compliance with these 92.7% production-validated rules.