ToggleButton
The ToggleButton
component is the Komplete UI representation of a KSP ui_button
.
import { ToggleButton } from kontakt_controls
export var main = ToggleButton(control_id: "my_button")
Constructor
control_id: String Required
This is the name that you assigned to the corresponding KSP ui_button
control.
text: String? = nil
The text to display if any.
style: ToggleButtonStyle = default_toggle_button_style
Customizes the appearance.
See ToggleButtonStyle for more details.
disabled: Bool = false
Disables user interaction when set to [true]
policy: TriggerPolicy = TriggerPolicy.on_up
Configures whether to toggle on pointer down or up.
See TriggerPolicy
ToggleButtonStyle
An alias for ToggleStyle.
export type ToggleButtonStyle = ToggleStyle
export var default_toggle_button_style = ToggleButtonStyle(
image: default_toggle_button_image,
width: nil,
height: nil,
padding: EdgeInsets(horizontal: 18, vertical: 4),
font_family: default_font,
font_weight: ui.font_weights.normal,
italic: false,
text_size: 12,
text_colors: ToggleStateColors(
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
ToggleButton
and Switch. This means that the default style of the Switch can also be assigned to theToggleButton
and vice-versa.