Checkbox
Checkbox
¶
Bases: Widget
A checkbox widget. Represents a boolean value. Can be toggled by clicking on it or by pressing the enter key or space bar while it has focus.
slider_pos = reactive(0.0)
class-attribute
¶
The position of the slider.
value = reactive(False, init=False)
class-attribute
¶
The value of the checkbox; True
for on and False
for off.
Changed
¶
__init__(value=False, *, animate=True, name=None, id=None, classes=None)
¶
Initialise the checkbox.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
bool
|
The initial value of the checkbox. Defaults to False. |
False
|
animate |
bool
|
True if the checkbox should animate when toggled. Defaults to True. |
True
|
name |
str | None
|
The name of the checkbox. |
None
|
id |
str | None
|
The ID of the checkbox in the DOM. |
None
|
classes |
str | None
|
The CSS classes of the checkbox. |
None
|
toggle()
¶
Toggle the checkbox value. As a result of the value changing, a Checkbox.Changed message will be emitted.