Switch
The Switch
component is the Komplete UI representation of a KSP ui_switch
.
import { Switch } from kontakt_controls
export var main = Switch(control_id: "my_switch")
Constructor
control_id: String Required
This is the name that you assigned to the corresponding KSP ui_switch
control.
text: String? = nil
The text to display if any.
style: SwitchStyle = default_switch_style
Customizes the appearance.
See SwitchStyle for more details.
disabled: Bool = false
Disables user interaction when set to [true]
policy: TriggerPolicy = TriggerPolicy.on_down
Configures whether to toggle on pointer down or up.
See TriggerPolicy
SwitchStyle
An alias for ToggleStyle.
export type SwitchStyle = ToggleStyle
export type SwitchStateColors = ToggleStateColors
export var default_switch_style = ToggleStyle(
image: default_switch_image,
width: nil,
height: nil,
padding: EdgeInsets(0),
font_family: default_font,
font_weight: ui.font_weights.normal,
italic: false,
text_size: 12,
text_colors: SwitchStateColors(
resting: Color(0xFFEEEEEE),
hovered: Color(0xFFEEEEEE),
pressed: Color(0xFFEEEEEE),
checked: Color(0xFFEEEEEE),
checked_and_hovered: Color(0xFFEEEEEE),
checked_and_pressed: Color(0xFFEEEEEE),
disabled: Color(0x3DEEEEEE),
checked_and_disabled: Color(0x3DEEEEEE),
),
text_alignment: ui.Alignment.center,
)
ToggleStyle is a shared type between
Switch
and ToggleButton. This means that the default style of the ToggleButton can also be assigned to theSwitch
and vice-versa.