Skip to content

choice_list

A list of chip-style options the player can tap. In single-select mode (default) tapping a chip immediately fires select. In multi-select mode the player can toggle multiple chips and submits via a built-in button. Options can be hardcoded (options) or bound to a data key (options_key).

C# factory

WidgetDefinitions.ChoiceList(
id: "vote",
options: new[]
{
new ChoiceOption { Id = "red", Label = "Red", Color = "#ef4444" },
new ChoiceOption { Id = "blue", Label = "Blue", Color = "#3b82f6" },
new ChoiceOption { Id = "green", Label = "Green", Color = "#22c55e" },
},
multi: false
);

Wire format

FieldTypeRequiredNotes
idstringyes
type"choice_list"yes
position_x, position_y, size_w, size_hnumberno0..1 anchor + size.
optionsChoiceOption[]one of theseInline options.
options_keystringone of theseBind to screen.data[options_key] (must resolve to ChoiceOption[]).
multibooleannoMulti-select with explicit Submit. Default false.
submit_labelstringnoMulti-mode Submit button label. Default "Submit".

ChoiceOption shape: { id: string, label: string, color?: string }. The label supports {key} bindings.

Events

Event typePayloadFires when
select{ choice_id: string }Single-mode: player taps an option.
submit{ choice_ids: string[] }Multi-mode: player taps Submit.

Example

manager.OnInput += (player, evt) =>
{
if (evt.WidgetId != "vote") return;
if (evt.EventType == "select")
{
var choice = evt.GetString("choice_id");
votes[choice] = (votes.GetValueOrDefault(choice, 0)) + 1;
}
};