# ToggleActor
The ToggleActor
can be used for various use cases to toggle "the current state". It uses a numeric integer index to indicate the current status. This status lies between 0
and a customizable maximum value. Additionally, there is value -1
(meaning not set). All other values are not allowed and would cause errors.
A typical example is the Viewstack component with its list of elements that are displayed individually. The viewstack always shows the child with the index equal to the ToggleActor's current status. By setting the ToggleActor's toggleState, the viewstack will update current displayed child.
# Properties
Parent:
Actor
Type:
ToggleActor
# Parameter
# Parameters in the Layout
Name | Type | Description |
---|---|---|
defaultState | number default: 0 | The state assigned at layout start. This state must be between 0 and stateCount - 1 . It can as well be -1 . If this value is not set, 0 is the default. |
stateCount | number default: 0 | The number of states the ToggleActor can accept. This value must be an integer greater than or equal to 0 . |
useGlobalToggleState | boolean default: false | Defines whether the current toggleState is only remembered for specific state on browser back (false ) or all states (even on forward navigation). |