# Class Dropdown

A dropdown widget with standard styling.

## Index

### Methods

- build
- getElement
- getValue
- reset
- select
- setValue

### Constructors

- constructor

## Methods

### build

- build(): HTMLElement

- - Defined in ui/FormWidgets/Dropdown.ts :82

  Gets the element on which the dropdown is bound.

  #### Returns HTMLElement

  The dropdown element.

### getElement

- getElement(): HTMLElement

- - Defined in ui/FormWidgets/Dropdown.ts :56

  Gets the element on which the dropdown is bound.

  #### Returns HTMLElement

  The dropdown element.

### getValue

- getValue(): string

- - Defined in ui/FormWidgets/Dropdown.ts :64

  Gets the currently selected dropdown value.

  #### Returns string

  The currently selected dropdown value.

### reset

- reset(): void

- - Defined in ui/FormWidgets/Dropdown.ts :44

  Resets the dropdown.

  #### Returns void

### select

- select(index: number, executeOnChange?: boolean): void

- - Defined in ui/FormWidgets/Dropdown.ts :74

  Selects a value from the dropdown [`listofValues`]{@link Dropdown.listOfValues}.

  #### Parameters

  - ##### index: number

    The 0-based index position of the value to select in the `listOfValues`.

  - ##### Default value executeOnChange: boolean = true

    Indicates whether to execute the [`onChange`]{@link Dropdown.onChange} function when this method changes the dropdown selection.

  #### Returns void

### setValue

- setValue(value: string): void

- - Defined in ui/FormWidgets/Dropdown.ts :90

  Sets the dropdown value.

  #### Parameters

  - ##### value: string

    The value to set the dropdown to.

  #### Returns void

## Constructors

### constructor

- new Dropdown(onChange?: function, listOfValues: string[], getDisplayValue?: function, label?: string): Dropdown

- - Defined in ui/FormWidgets/Dropdown.ts :19

  Creates a new `Dropdown`.

  #### Parameters

  - ##### Default value onChange: function = (dropdown: Dropdown) => {}

    The function to call when the dropdown selected value changes. This function takes the current `Dropdown` instance as an argument.

    - - (dropdown: Dropdown): void

      - #### Parameters

        - ##### dropdown: Dropdown

        #### Returns void

  - ##### listOfValues: string[]

    The selectable values to display in the dropdown.

  - ##### Default value getDisplayValue: function = l

    An optional function to modify the display values, rather than using the values as they appear in the `listOfValues`.

    - - (string: any): string

      - #### Parameters

        - ##### string: any

        #### Returns string

  - ##### Optional label: string

    The label to use for the input for accessibility purposes.

  #### Returns Dropdown

### Hierarchy

- Dropdown

### Implements

- IFormWidget
- IFormWidgetSettable