UI Checkbox
Updated
A checkbox with a label.
- Type
comp-ui-checkbox- Script class
UICheckboxComponent- Per entity
- One
- Version
- 1.2.0
Read about it in Controls: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
margin |
||
margin[] |
- |
|
padding |
||
padding[] |
0 ≤ x ≤ 16384 |
|
size |
0 ≤ x ≤ 4096 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
UICheckbox::change
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Radio buttons with a selection groupThree UI Checkboxes drawn as radio buttons and made exclusive by a UI Selection Group, which a Behavior script adds; the log reports the chosen difficulty.
Pick Easy, Normal or Hard: the others turn off and the log names your choice. Drag outside the panel to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(UICheckboxComponent); if (component) log(component.props);}