Reference machines
switchMachine
interface 2 type 3 function 1
# CreateSwitchInput
Members
disabled?optional disabled?: booleanConstruct the machine in the disabled state. Defaults to
false.initial?optional initial?: booleanInitial checked value. Defaults to
false.
# SwitchContext
Members
checkedchecked: booleanWhether the switch is currently on. Mirrored as
aria-checked.togglestoggles: numberNumber of user-initiated toggles since construction.
# SwitchEvent
SwitchEvent = { type: "TOGGLE"; } | { checked: boolean; type: "SET"; } | { type: "DISABLE"; } | { type: "ENABLE"; }All events the Switch machine can receive.
# SwitchMachine
SwitchMachine = Machine<SwitchContext, SwitchEvent, SwitchState># SwitchState
SwitchState = "off" | "on" | "disabled"# createSwitchMachine ( )
createSwitchMachine(input?): SwitchMachineConstruct a fresh Switch machine.
Parameters
input?CreateSwitchInput = {}
Returns
SwitchMachine