.. _stdlib_ui_checkbox_component: ========== UICheckbox ========== +++++++ Classes +++++++ .. _struct-ui_checkbox_component-UICheckbox: .. das:attribute:: UICheckbox : UIComponent .. note:: ``UIFrame`` component is automatically added to the node if it is not already present Checkbox UI component that toggles a boolean value when clicked. Usage example:: def init_checkbox() { get_component(node) $(var checkbox : UICheckbox?) { checkbox.onChange = @(newValue : bool) { print("Checkbox {checkbox.nodeId} toggled to {checkbox.value}!") } } } :Fields: * **toggleNode** : :ref:`NodeId ` - Node that visually represents the toggled state. * **toggleFadeDuration** : float = 0.1f - Duration of fade animation when toggling. * **onChange** : lambda<(value:bool):void> - Callback invoked when the value changes. .. _function-ui_checkbox_component_UICheckbox_rq_on_initialize_UICheckbox: .. das:function:: UICheckbox.on_initialize() Initializes the checkbox component, sets up event listeners and initial state. .. _function-ui_checkbox_component_UICheckbox_rq_setValue_UICheckbox_bool_bool: .. das:function:: UICheckbox.setValue(newValue: bool; doFade: bool) Sets the value and updates the toggle node. :Arguments: * **newValue** : bool - The new value. * **doFade** : bool - Whether to animate the toggle. .. _function-ui_checkbox_component_UICheckbox_rq_invalidate_UICheckbox_bool: .. das:function:: UICheckbox.invalidate(doFade: bool) Updates the visual state of the checkbox. :Arguments: * **doFade** : bool - Whether to animate the toggle. :Properties: .. _function-ui_checkbox_component__dot__rq_value_UICheckbox: .. das:operator:: UICheckbox.value() : bool Gets the current value of the checkbox. .. _function-ui_checkbox_component__dot__rq_value_rq_clone_UICheckbox_bool: .. das:operator:: UICheckbox.value =(newValue: bool) Sets the value of the checkbox and updates the toggle node. :Arguments: * **newValue** : bool