Add a disabled keyword argument to the Switch constructor

This commit is contained in:
Dave Pearson
2023-02-14 12:50:58 +00:00
parent 3c8f464818
commit 9e4d4aae5e

View File

@@ -100,6 +100,7 @@ class Switch(Widget, can_focus=True):
name: str | None = None,
id: str | None = None,
classes: str | None = None,
disabled: bool = False,
):
"""Initialise the switch.
@@ -109,8 +110,9 @@ class Switch(Widget, can_focus=True):
name: The name of the switch.
id: The ID of the switch in the DOM.
classes: The CSS classes of the switch.
disabled: Whether the switch is disabled or not.
"""
super().__init__(name=name, id=id, classes=classes)
super().__init__(name=name, id=id, classes=classes, disabled=disabled)
if value:
self.slider_pos = 1.0
self._reactive_value = value