Switch

A control that allows the user to toggle between checked and not checked.

API Reference

Switch

NameTypeDefault
name:stringnil
value:string"1"
The value sent to the server when the switch is in the checked/on state.
unchecked_value:string"0"
The value sent to the server when the switch is in the unchecked/off state.
checked:booleanfalse
The initial state of the switch.
include_hidden:booleantrue
Whether to include a hidden field that ensures a value is sent even when the checkbox is unchecked.
disabled:booleanfalse
When true, disables the switch and prevents user interaction while maintaining visual state.
attributeskeyword arguments

Keyboard Interactions

KeyDescription
SpaceChecks/unchecks the switch.
EnterChecks/unchecks the switch.

Examples