Skip to main content

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 type and meta.name
  • โœ… Use descriptive, camelCase names (TankLevelIndicator, not Label1)
  • โŒ 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.xy or ia.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.flex as 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 tag bindings for real-time data
  • โœ… Use expr bindings 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.view for 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.gauge for single-value indicators
  • Use ia.chart.xy for time series data
  • Use ia.chart.powerchart for complex industrial data

Input Componentsโ€‹

  • Use ia.input.button for actions
  • Use ia.input.toggle-switch for boolean states
  • Use ia.input.numeric-entry-field for number inputs

Industrial Symbolsโ€‹

  • Use ia.symbol.sensor for sensor representations
  • Use ia.symbol.valve for valve controls
  • Use ia.display.led-display for 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.