Skip to content

LED

Round or square LED indicator (BOOL-001, BOOL-002).

LED, light theme LED, dark theme

Indicators, discrete · Widget catalog · API reference · schema led.schema.json

Example

The traits of the picture above:

ai.LED(value=True, label="LED on")

Traits

Trait Type Default Set by Description
blink boolean false host Blink while on (steady outline when reduced motion is requested, A11Y-005).
blink_hz number 2 host Blink frequency in Hz.
mode "control", "indicator" "indicator" host "control": the user sets the value; "indicator": display only.
off_color string "" host CSS color when off; empty: a dark version of on_color.
on_color string "#22c55e" host CSS color when lit; unsafe colors are ignored (SEC-002).
shape "round", "square" "round" host LED shape (the state is also given by text for assistive technologies, A11Y-003).
size array [48,48] host [width, height] in CSS pixels.
Common traits (12), 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).
value boolean false host, widget State of the control or indicator. Set by the host, or by the user in control mode.
default_state boolean false host State a latch returns to once the host has read it (BOOL-008).
mechanical_action "switch_when_pressed", "switch_when_released", "switch_until_released", "latch_when_pressed", "latch_when_released", "latch_until_released" "switch_when_pressed" host How the control reacts to the pointer (BOOL-007). With a latch, the host reads the value and restores default_state; without a host that does it, a latched value stays set.
latch_timeout number 0 host Seconds after which an unread latch expires (host side); 0: never.
confirm boolean false host Ask for a confirmation before changing the value (BOOL-011).

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.