GCheckBox

A customizable checkbox widget with various properties for appearance, cursor behavior, and animations for different states.

Example

#![allow(unused)]
fn main() {
use makepad_widgets::*;

live_design! {
    import makepad_widgets::base::*;
    import makepad_widgets::theme_desktop_dark::*; 
    import gen_components::components::*;

    GCheckBoxExample = <ScrollYView>{
        height: 150.0,
        width: Fill,
        spacing: 10.0,
        flow: Down,
        <GLabel>{
            text: "GCheckBox"
        }
        <GCheckBox>{
           
        }
        <GCheckBox>{
            theme: Warning,
            check_type: Tick,
        }
        <GCheckBox>{
            theme: Error,
            check_type: Cross,
        }
        <GCheckBox>{
            theme: Success,
            height: 30.0,
            width: 60.0,
            size: 12.0,
            scale: 0.6,
            border_width: 2.0,
            check_type: Round,
            background_color: #000,
            selected_color: #42A5F5,
            hover_color: #FF7043,
            border_color: #76828F,
        }
        <GCheckBox>{
            theme: Dark,
            height: 30.0,
            width: 60.0,
            size: 12.0,
            check_type: Tick,
        }
        
    }
}
}

Props

decoratenametypedescription
livethemeThemesThe theme applied to the checkbox.
livesizef32The size of the checkbox.
livebackground_colorOption<Vec4>The background color of the checkbox.
livehover_colorOption<Vec4>The color of the checkbox when hovered.
livefocus_colorOption<Vec4>The color of the checkbox when focused.
liveselected_colorOption<Vec4>The color of the checkbox when selected.
liveborder_colorOption<Vec4>The border color of the checkbox.
liveborder_widthf32The width of the checkbox's border.
livescalef32The scale of the checkbox.
livecursorOption<MouseCursor>The cursor type when hovering over the checkbox.
livevalueStringThe value associated with the checkbox.
livecheck_typeGChooseTypeThe type of the checkbox.
redrawdraw_checkDrawGCheckBoxThe component used for drawing the checkbox.
walkwalkWalkThe positioning properties for the checkbox.
layoutlayoutLayoutThe layout properties for the checkbox.
animatoranimatorAnimatorThe animation properties for the checkbox.

Event

namedescription
ChangedTriggered when the checkbox state changes, carrying the new state and associated value.
HoverTriggered when the checkbox is hovered.

Note: Events with None are omitted.