Skip to content

CheckBox

import { CheckBox } from "std-widgets.slint";
export component Example inherits Window {
width: 200px;
height: 25px;
background: transparent;
CheckBox {
x: 5px;
width: parent.width;
height: parent.height;
text: "Hello World";
}
}
slint
checkbox example

Use a CheckBox to let the user select or deselect values, for example in a list with multiple options. Consider using a Switch element instead if the action resembles more something that’s turned on or off.

Properties

checked

bool (in-out) default: false

Whether the checkbox is checked or not.

CheckBox {
text: self.checked ? "Checked" : "Not checked";
checked: true;
}
slint

enabled

bool default: true

Defaults to true. When false, the checkbox can’t be pressed.

has-focus

bool (out) default: false

Set to true when the checkbox has keyboard focus.

text

string default: ""

The text written next to the checkbox.

CheckBox {
text: "CheckBox with text";
}
slint

Callbacks

toggled()

The checkbox value changed

CheckBox {
text: "CheckBox";
toggled() => {
debug("CheckBox checked: ", self.checked);
}
}
slint

© 2024 SixtyFPS GmbH