# WRTKit SelectionList Class

## Description

The SelectionList class is an implementation of a selection control that displays a list of options to the user. Options are displayed as radio buttons or checkboxes depending on if the control is in single or multiple-selection mode. Selection lists are useful in situations where the widget is used in pointer navigation mode or if there is a small amount of options.

Figure 1. SelectionList controls

## Inherits from

SelectionControl

Parent topic: WRTKit API Reference

## Constructor

### Syntax

    [SelectionList] new SelectionList(String id, String caption, Array options, Boolean multipleSelection, Array|Option selected)

### Description

Creates a new instance of the SelectionList class.

### Arguments

- id

  Unique identifier for the control. Can be retrieved using the id property defined in the UIElement class that this control inherits from. Useful for example to identify the source of an event in event callback functions or to apply a CSS rule to only this particular control. The identifier can be null, in which case no id will be set for the control.

- caption

  The caption text for the control. A null caption can be used to hide the caption area. The value is an XHTML string.

- options

  An array of options that the selection list should display to the user. If the argument is omitted or null the control will not display any options. The options can be set or changed later by calling setOptions(). Options are objects with two properties: value and text. Use JavaScript object notation (JSON) to construct option objects, e.g. `{ value: "value here", text: "Text for value goes here" }`. The text value is an XHTML string.

- multipleSelection

  The multipleSelection argument is a boolean flag that determines whether the control should be in multipleSelection mode or not. Use true to put the control in multiple selection mode and false to put it in single selection mode. If this argument is omitted the control will go to single selection mode by default.

- selected

  The selected argument specifies which of the options should be selected at creation time. For multiple selection controls this should be given as an array of option objects with an empty array if no options should be selected. For single selection controls this should be the single option object that should be selected or null if no option should be selected. If the argument is omitted or null no options will be selected.

### Return value

A new instance of the SelectionList class.