Skip to main content

switch

Switch

from dara.components.common.switch import Switch

class Switch(FormComponent)

Switch

A component that creates a switch. Takes a boolean value that determines whether the switch is on or off.

A Switch component is created via:


from dara.core import Variable
from dara.components.common import Switch

Switch(value=Variable(default=True))

Arguments:

  • value: Boolean Variable instance recording the component's state
  • onchange: Action triggered when the component switches states.
  • id: the key to be used if this component is within a form

Attributes

  • value:
  • onchange: Optional[Action]
  • id: Optional[str]