Skip to content

Checkbox

Note

Use a Checkbox when the user chooses items from a list. Use a Switch for a setting that takes effect immediately.

Checkbox lets the user turn one option on or off. The check mark is drawn in two strokes.

Usage

Call Components.Checkbox with a scope and a table of properties:

C.Checkbox(scope, {
    Label = "Remember me",
    Checked = true,
    OnChanged = function(checked)
        print("Checked:", checked)
    end,
})

Properties

Name Type Required Default Description
Theme ThemeRef ❌ The contextual theme Theme to use for this component instead of the one from Theme.Provide.
LayoutOrder UsedAs<number> ❌ 0 Position in a parent UIListLayout or UIGridLayout.
Size UsedAs<UDim2> ❌ - Size of the component.
Checked UsedAs<boolean> ❌ false The value. A plain value is only the starting value. A Value stays in step with the control: the user's changes set it, and setting it changes the control.
Label UsedAs<string> ❌ - Text next to the box.
Disabled UsedAs<boolean> ❌ false Stops the box reacting to input. The component reads this once, when it creates the checkbox.
Id string ❌ - Key that identifies this component when state is kept across rebuilds. See Persist.

Callbacks

Name Description
OnChanged: (boolean) -> () Runs with the new value when the user turns the box on or off.

See also