Skip to content

SelectorSwitch

Rotary selector with 2 to 5 labelled positions, optionally a key switch (IND-010 .. IND-013).

SelectorSwitch, light theme SelectorSwitch, dark theme

Controls, discrete · Widget catalog · API reference · schema selectorswitch.schema.json

Example

The traits of the picture above:

ai.SelectorSwitch(value="AUTO", label="SelectorSwitch")

Traits

Trait Type Default Set by Description
size array [140,130] host [width, height] in CSS pixels.
value string "" host, widget Label of the selected position. Empty, or not one of positions: default_position, else the middle position (the Python class resolves it when the widget is created).
positions array of string ["HAND","OFF","AUTO"] host 2 to 5 distinct position labels, left to right.
keyed boolean false host Key switch: with locked, the front end cannot move it (IND-012).
locked boolean false host Key removed: the position is locked for the operator (the host can still set it).
default_position string or null null host Position the switch returns to from a spring-return position; also the resolved value. Ignored when not one of positions.
spring_return array of string [] host Positions that go back to default_position when the operator releases the switch (IND-013).
Common traits (8), shared with other widgets
Trait Type Default Set by Description
mode "control", "indicator" "control" host "control": the user sets the value; "indicator": display only.
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.