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
| Field | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
type | "choice_list" | yes | |
position_x, position_y, size_w, size_h | number | no | 0..1 anchor + size. |
options | ChoiceOption[] | one of these | Inline options. |
options_key | string | one of these | Bind to screen.data[options_key] (must resolve to ChoiceOption[]). |
multi | boolean | no | Multi-select with explicit Submit. Default false. |
submit_label | string | no | Multi-mode Submit button label. Default "Submit". |
ChoiceOption shape: { id: string, label: string, color?: string }. The label supports {key} bindings.
Events
| Event type | Payload | Fires 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; }};