swiftlys2/docs/api/ai/
API Reference › Menu.Components

ChoiceComponent

Class
Namespace: SwiftlyS2.Shared.Menu.Components · Assembly: SwiftlyS2.CS2.dll
public class ChoiceComponent : ChoiceComponent<string>, IMenuComponent
Inherits object, MenuComponentBase, TextComponent, MenuValueComponent<int>, MenuChoiceComponentBase<string>, ChoiceComponent<string>
Implements IMenuComponent

A selectable line that cycles through a list of strings.

View source

Constructors

ChoiceComponent(string, IEnumerable<string>?, int, Action<MenuValueChangedContext<string>>?, string?)

Creates a choice.

public ChoiceComponent(string text = "", IEnumerable<string>? choices = null, int defaultIndex = 0, Action<MenuValueChangedContext<string>>? onItemChanged = null, string? id = null)
Parameters
  • textstringoptionalThe label to display.
  • choicesIEnumerable<string>?optionalThe strings to cycle through.
  • defaultIndexintoptionalThe index a player starts on.
  • onItemChangedAction<MenuValueChangedContext<string>>?optionalRuns after the selection moves.
  • idstring?optionalA stable id, or null to generate one.