Presentation
Presentation hints let the backend suggest a visualization without specifying pixels.
Purpose
Backend says "this is a gauge", not "fontSize: 28, padding: 12". The runtime owns layout.
UI inference (automatic)
| Property semantics | Inferred component |
|---|---|
| number | Metric |
| number + min/max | Gauge |
| number + history | Trend |
| boolean read-only | Status |
| boolean writable | Switch |
| enum writable | Select |
| string | Text |
| location | Map |
Presentation hints (explicit)
python
Number(view="slider")
Number(view="progress")
Boolean(view="alarm")
Enum(view="badge")
String(view="image" | "table" | "log")All 16 supported views
| Category | Views |
|---|---|
| READ | metric, gauge, trend, status, text, progress, alarm, badge, image, table, log, map |
| WRITE | switch, select, slider, input |
| ACTION | action button (stateless — not a property view) |
Rules
viewoverrides inference- Hints are preferences, not contracts — the UI may adapt
iconon Page/Action is a semantic token (chart,gauge,temperature), not a renderer icon name
Anti-pattern (what NOT to do)
json
{ "fontSize": 28, "padding": 12, "x": 100, "width": 240 }This is pixel specification — forbidden. The runtime owns layout.
Also avoid renderer leakage: gap: 4px (use density: "compact") and icon: "bar-chart-outline" (use icon: "chart").
Common mistakes
- Using
view="gauge"on a property without min/max → gauge still works with defaults - Confusing
viewwith user config —viewis backend default, user can override locally - Sending pixel/icon-library values instead of semantic tokens