Configuration AttributeDisplay Widget
The widget configuration schema is defined in src/index.ts.
Settings Overview
Key |
UI Label |
Type |
Default |
Description |
|---|---|---|---|---|
|
Title |
|
|
Optional title. Supports formatted input expressions/variables. |
|
Tango attributes |
|
|
Attribute source list (endpoint + full attribute path). Supports formatted input in |
|
Use Live Data (subscribe) |
|
|
If enabled, subscribe to live updates. If disabled, use one-shot query/polling cadence. |
|
Show Enum Labels |
|
|
Show enum labels instead of raw numeric values when metadata is available. |
|
Value Path |
|
|
Select a single element/key from an array or object value using a dot/bracket path. Empty shows the whole value. See Value Path. |
|
Decimal Places |
|
|
Round every number in the displayed value to this many decimal places. Empty keeps full precision. See Decimal Places. |
|
DevString View Mode |
|
|
DevString rendering mode: |
|
Color JSON Values by Type |
|
|
Color JSON values by type in JSON tree modes. |
|
Background Color |
|
|
Base card background color. |
|
Use State Background Color |
|
|
If enabled, background color follows SDK state color mapping with contrast-aware text. |
|
Conditional Background Value |
|
|
Value/expression used as comparison target for conditional background styling. |
|
Conditional Background Operator |
|
|
Comparison operator: |
|
Conditional Background Color |
|
|
Background color applied when condition matches. |
|
Value Color |
|
|
Value text color. |
|
Title Color |
|
|
Title text color. |
|
Font Size |
|
|
Base font size for title/value (for example |
|
Title Placement |
|
|
Title position relative to value: |
|
Content Horizontal Alignment |
|
|
Horizontal alignment of the title/value block: |
|
Content Vertical Alignment |
|
|
Vertical alignment of the title/value block: |
Value Path
Many Tango attributes do not return a single scalar. Spectrum and image attributes
arrive as arrays, and DevString attributes frequently carry JSON payloads (often
double-encoded, e.g. ["{\"channels\": [0, 1, 2]}"]). Value Path lets you drill
into such a value and display just one element or key instead of the whole structure.
Leave it empty to display the entire value unchanged.
How a path is parsed
The path is split into tokens on dots (.) and brackets ([ ]). Each token is
either:
an array index — a bare integer such as
0,2, or a negative index like-1;an object key — anything that is not a plain integer, such as
channelsorstatus.
So channels[0] and channels.0 are equivalent, and both mean “the key channels,
then index 0”. Whitespace around the path is ignored, and empty segments are
skipped.
Indexing into arrays
Path |
Applied to |
Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
A very common case is a [timestamp, value] pair where you only want the reading:
set the path to 1 (or -1) to pick the elevation/value and drop the timestamp.
Negative indices count from the end of the array, so -1 is always the last
element regardless of length.
Reaching into objects and nested structures
Path |
Applied to |
Result |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can freely mix keys and indices in a single path, e.g. readings[2].t or
pointing.az[0].
Automatic JSON parsing
Tango DevString values are often JSON encoded as strings. Value Path parses JSON
strings transparently as it traverses, so you do not need to do anything special:
A top-level JSON string such as
'{"channels": [0, 1, 2]}'is parsed before the first token is applied, sochannels[0]works directly.JSON strings encountered mid-traversal (a JSON string nested inside an array or object) are also parsed on the fly, so deeply/double-encoded payloads resolve segment by segment without extra steps.
Single-element array unwrapping
A frequent Tango shape is a one-element array that wraps an object or JSON string,
for example ["{\"channels\": [0, 1, 2]}"]. When the next token is an object key,
a single-element array wrapper is unwrapped automatically. This means:
channelsresolves against["{\"channels\": [...]}"]exactly as0.channelswould — you can skip the leading0.
Note this convenience only applies when descending by an object key. If you genuinely
want the first element of an array, use an explicit index (0).
When the path cannot be resolved
If any segment does not exist (missing key, out-of-range index, or a token applied to
a value that is not an array/object), the result is empty — the value displays as -.
Double-check the path against the real shape of the attribute if you see -
unexpectedly.
Order of operations
Value Path is applied first, before Decimal Places rounding and
before the DevString view mode formats the result. So you can select a nested array
with Value Path and still have its numbers rounded, or render the selected array with
array-list mode.
Decimal Places
Rounds every finite number found in the displayed value to the given number of decimal places. The rounding walks into arrays and objects recursively, so it applies to all numbers in a structured value, not just a top-level scalar.
Leave empty for full precision (the default).
Example: with
decimalPlaces: 3, a value of29.80312displays as29.803.It also applies element-wise to arrays —
[29.80312, 30.14987]becomes[29.803, 30.15].Trailing zeros are not padded: rounding
30.1to 3 places stays30.1, not30.100(the value is rounded numerically, not formatted to a fixed width).Non-numeric values (strings, booleans,
null) are left untouched.Negative or non-numeric settings are ignored and leave the value unchanged.
As noted above, rounding happens after Value Path selection, so it operates on whatever Value Path produced.
Notes
attributeshasminItems: 1; at least one attribute source is required.propertyTypeandlevelmetadata are used by the settings UI for grouping and progressive disclosure.Expression/variable support for formatted fields comes from the shared widget SDK formatted input parser.