> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Spinner Element

> Spinner Element — CometChat documentation.

The `SpinnerElement` class is utilised to create a single selection input element in a user interface.

### Constructor

| Name      | Type                  | Description                                                       |
| --------- | --------------------- | ----------------------------------------------------------------- |
| elementId | `string`              | This property in constructor accepts the Id for the element       |
| label     | `string`              | This property in constructor accepts the label for SpinnerElement |
| options   | `List<OptionElement>` | This property in constructor accepts options for SpinnerElement   |

### Class Usage

Here's how to create an instance of the `SpinnerElement` class:

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    OptionElement option1 = new OptionElement("Option1", "1");
    OptionElement option2 = new OptionElement("Option2", "2");
    List<OptionElement> optionElementList = new ArrayList<>();
    optionElementList.add(option1);
    optionElementList.add(option2);

    SpinnerElement spinnerElement = new SpinnerElement("idSelect", "Choose an option", optionElementList);
    ```
  </Tab>
</Tabs>

In this example, a new instance of `SpinnerElement` is created with an elementId "idSelect", a label "Choose an option", and a list of two options.

### Key Properties and Methods

#### Default Value of the Input Element

The `setDefaultValue()` method sets the default value in the single select input, while the `getDefaultValue()` retrieves it.

For example:

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    spinnerElement.setDefaultValue("1");
    ```
  </Tab>
</Tabs>

### Example

Here is an example that showcases the creation and manipulation of an instance of `SpinnerElement`:

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    // Create some options
    OptionElement option1 = new OptionElement("Option1", "1");
    OptionElement option2 = new OptionElement("Option2", "2");
    List<OptionElement> optionElementList = new ArrayList<>();
    optionElementList.add(option1);
    optionElementList.add(option2);

    // Create a new instance of SingleSelectElement
    SpinnerElement spinnerElement = new SpinnerElement("1", "Choose an option", optionElementList);

    // Set and get the default value
    spinnerElement.setDefaultValue("1");
    ```
  </Tab>
</Tabs>
