Skip to main content
Elements are the controls inside a tab. Create one from a tab or group, and it returns a handle you can read from and drive later.
Rayfield Gen2 elements in a window

Shared properties

Every element accepts these on top of its own.
name
string
The label.
description
string
Hint text under the label.
icon
string | number
An icon shown beside the label.

Value handles

Every value element (toggle, slider, dropdown, input, keybind, color picker) follows the same shape.
  • Read the current value from .value.
  • Write it with Set(value). This fires the callback, so the change actually takes effect.
  • Pass Set(value, true) to skip the callback when you only want to move the UI.

Flags

Value elements save on their own under a key derived from their name. Pass an explicit flag when the name is localized, might be renamed, or could collide with another element. Set forgetState = true to skip saving entirely.
Read or write any flag through window.Flags, window:Get, and window:Set. See Saving.

Reordering

Every element handle can move within its tab.
MoveTo(index)
MoveToTop()
MoveToBottom()
MoveUp()
MoveDown()

The elements

Button

Run a function on click.

Toggle

Switch a boolean on and off.

Slider

Pick a number in a range.

Dropdown

Choose one option or several.

Input

A text field.

Keybind

A rebindable key.

Color picker

Pick a colour and alpha.

Stat

A read-only number that rolls on change.