BitField¶
Integer word (status or fault word, register) shown as a row of indicators, one per bit (IND-111, IND-112).

Indicators, discrete · Widget catalog · API reference ·
schema bitfield.schema.json
Example¶
The traits of the picture above:
ai.BitField(
value=2067,
label="BitField (drive status word)",
labels=[
"Ready",
"Running",
"Warning",
"At speed",
"Fault",
"",
"",
"",
"Remote",
"",
"",
"Brake",
"",
"",
"",
"",
],
colors=["", "", "#f59e0b", "", "#dc2626"],
)
Traits¶
| Trait | Type | Default | Set by | Description |
|---|---|---|---|---|
mode |
"control", "indicator" |
"indicator" |
host | "control": the user sets the value; "indicator": display only. |
size |
array | [520,76] |
host | [width, height] in CSS pixels. |
value |
integer | 0 |
host, widget | The word; bit 0 is the least significant bit. Must be below 2**bits (Python rejects larger values; the front end shows only the bits of the word). Set by the host, or by the user toggling a bit in control mode (IND-112). |
bits |
8, 16, 32 |
16 |
host | Word size. |
labels |
array of string | [] |
host | Label of each bit, bit 0 first; a bit without a label is shown dimmed. |
colors |
array of string | [] |
host | CSS on color of each bit, bit 0 first; empty or missing: on_color. |
on_color |
string | "#22c55e" |
host | CSS color of a set bit. |
msb_first |
boolean | true |
host | Draw the most significant bit on the left, as the word is written. |
show_hex |
boolean | true |
host | Also show the word in hexadecimal. |
Common traits (7), shared with other widgets
| Trait | Type | Default | Set by | Description |
|---|---|---|---|---|
label |
string | "" |
host | Plain text, never interpreted as HTML (SEC-002). |
disabled |
boolean | false |
host | Greyed out, input rejected. |
visible |
boolean | true |
host | |
tooltip |
string | "" |
host | Plain text shown on hover. |
style |
"modern", "classic", "system" |
"modern" |
host | |
theme |
"auto", "light", "dark", "system" |
"auto" |
host | "auto": the style decides; "system": the host page or the operating system (STYLE-007). |
skin |
object | {} |
host | Replaceable drawing parts: part name -> SVG source, sanitized (STYLE-005, STYLE-006). |
Set by: host, the program (Python, Julia, ...); widget, the user through the widget;
derived, computed from other traits by the host that owns the state, or by the widget.
See the trait contract.