Checkbox¶
Registers a Material Design Checkbox PseudoInstance which can be instantiated via PseudoInstance.new("Checkbox")
local Resources = require(game:GetService("ReplicatedStorage"):WaitForChild("Resources")) local PseudoInstance = Resources:LoadLibrary("PseudoInstance") local Checkbox = PseudoInstance.new("Checkbox")
Only Global ZIndexBehavior is officially supported.
Checkbox API¶
Checkbox inherits from PseudoInstance and SelectionController, so all properties, methods, and events of these can also be used on Checkboxes.
Checkbox:SetChecked¶
void Checkbox:SetChecked(boolean Checked = not self.Checked)
Sets the Checked property and animates to the new state. Fires OnChecked
Fields¶
Wrapped Properties¶
Properties which access its top-level ImageButton:
| Property | Type |
|---|---|
| AnchorPoint | Vector2 |
| Name | string |
| Parent | Instance |
| Position | UDim2 |
| LayoutOrder | int |
| NextSelectionDown | Instance |
| NextSelectionLeft | Instance |
| NextSelectionRight | Instance |
| NextSelectionUp | Instance |
| ZIndex | int |
SelectionController Properties¶
| Property | Type | Description |
|---|---|---|
| Indeterminate | Boolean | Whether the Checkbox is Indeterminate |
| Checked | Boolean | Whether the Checkbox is Checked |
| Disabled | Boolean | Whether the Checkbox is Disabled |
| PrimaryColor3 | Color3 | The Color3 of the Checkbox when Checked |
| Theme | Enumeration.MaterialTheme | "Dark" or "Light" colored frame when not Checked |
Events¶
| Event | Description |
|---|---|
| OnChecked | Fires after the Checked property was changed |
Checkbox inherits from PseudoInstance¶
Example¶
Click here for the example place
Demo code:
local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Resources = require(ReplicatedStorage:WaitForChild("Resources")) local Color = Resources:LoadLibrary("Color") local PseudoInstance = Resources:LoadLibrary("PseudoInstance") local LocalPlayer repeat LocalPlayer = Players.LocalPlayer until LocalPlayer or not wait() local PlayerGui repeat PlayerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui") until PlayerGui or not wait() local Screen = Instance.new("ScreenGui", PlayerGui) local Frame = Instance.new("Frame", Screen) Frame.BackgroundColor3 = Color.Grey[200] Frame.BorderSizePixel = 0 Frame.Size = UDim2.new(1, 0, 1, 0) local ReceiveUpdates = PseudoInstance.new("Checkbox") ReceiveUpdates.PrimaryColor3 = Color.Teal[500] ReceiveUpdates.Checked = true ReceiveUpdates.OnChecked:Connect(function(On) print(On) -- On is the new value of `Checked` end) ReceiveUpdates.AnchorPoint = Vector2.new(0.5, 0.5) ReceiveUpdates.Position = UDim2.new(0.5, 0, 0.5, 0) ReceiveUpdates.Theme = "Light" -- "Dark" is also valid ReceiveUpdates.Parent = Frame