AddOptionGrid
Select visual option cards with optional embedded controls and runtime layout settings.
AddOptionGrid
Adds selectable option cards with images or embedded XLQP elements. Supports single or multiple selection, automatic columns, a settings popover, and saved flags. Aliases: CreateOptionGrid and OptionGrid.
local Options = Tab:AddOptionGrid({
Name = "Mode",
Default = "balanced",
Options = {
{Name = "Instant", Value = "instant"},
{Name = "Balanced", Value = "balanced"},
{Name = "Deep", Value = "deep"},
},
Callback = function(value, entry)
print(value)
end,
})Options
| Field | Default / behavior |
|---|---|
Name / Title | Option Grid. |
Options | List of option tables or scalar values. |
Default / Value | Initial selected value; list for multiple selection. |
Multi / MultiSelect | False; true returns a selected-value list. |
Rows | True; false selects the vertical list layout. |
Height, Width, Custom | 260, 500, false. Width is fixed only in custom sizing mode. |
CardWidth, CardHeight | 82 each; minimum 54. |
Spacing, Columns | 6 and 0. Zero columns means automatic layout. |
Icon / HeaderIcon, SettingsIcon | Header and settings icons. |
ShowHeaderIcon, ShowSettingsButton, ShowSettingsSummary | True unless disabled. |
Flag, Save | Flag identity and persistence through window configuration saving. |
Callback(valueOrValues, entry) | Selection callback. |
Option entries support Name, Value, Image, Disabled, LayoutOrder, Callback, Elements, and Build / function-valued Content. Element specifications use {Type = "Slider", Config = {...}}; a builder receives the element API, content frame, option entry, and grid.
Controller
AddOption, RemoveOption, UpdateOption, Clear, Set(value, silent), Get, GetSelected, SetMulti, SetRows, SetCardSize(width, height), SetSpacing, SetColumns, SetCustom, Resize(height, width), SetIcon, SetSettingsIcon, SetSettingsOpen, and ToggleSettings.
AddElement(optionValue, elementType, config) adds a control to an existing option card and returns the created controller when successful.
The callback's first value is a scalar for single selection or a cloned selected-value list for multiple selection. Disabled cards cannot be selected.