Toggle¶
Toggle is used to toggle the selection of an item on or off. They are best used to let users adjust settings.
Usage¶
Toggle can be created by calling Lydie.Components.Controls.Toggle
:
Lydie.Components.Controls.Toggle {
OnClick = function(state) -- (1)!
state:set(not state:get())
print("Toggle Clicked", state:get())
end,
},
- When passing an
OnClick
function to the toggle, it is important to know that the default behavior of the toggle will be overridden. The toggle state will not react to the user response automatically and requires manual intervention. See Toggle.luau:80.
Properties¶
Name | Description | Required | Default |
---|---|---|---|
ZIndex |
The Z index of the button, used to show hierarchy of the button. | 1 |
|
Position |
The relative position of the button | UDim2.fromOffset(0, 0) |
Functions¶
Name | Description | Required |
---|---|---|
OnClick: (state: Fusion.Value<boolean>) -> () |
A function invoked when MouseButton1Up is fired, where a user clicks the button and releases |