# Blazor DropDownList Overview

The Blazor DropDownList component allows the user to choose an option from a predefined set of choices presented in a dropdown list popup. The developer can control the [data](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind), sizes, and various appearance options like class and [templates](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/templates).

<span class="cta-panel-big-module--container--c08a9 d-print-none "><span class="row align-items-center justify-content-center cta-panel-big-module--row--9b71a"><span class="col-auto"><img class="cta-panel-big-module--icon--a648c" src="/blazor-ui/documentation/assets/35a2c49c0e7b061f81d272dd33a23e0d/avatar-ninja.svg" alt="AI coding assistants icon"></span><span class="col-12 col-sm"><span class="cta-panel-big-module--message--40a0f">Tired of reading docs? With our new AI Coding Assistants, you can add, configure, and troubleshoot Telerik UI for Blazor components—right inside your favorite AI-powered IDE: Visual Studio, VS Code, Cursor, and more. Start building faster, smarter, and with contextual intelligence powered by our docs/APIs:</span></span><span class="col-12 col-lg-auto"><a class="cta-panel-big-module--btnTrial--38b3e" href="https://www.telerik.com/blazor-ui/documentation/ai/overview?utm_source=ai-assistants-docs" target="_blank">Try AI Assistants</a></span></span></span>

## Creating Blazor DropDownList

1. Use the `TelerikDropDownList` tag to add the Blazor dropdown list to your Razor page.
2. Populate its `Data` property with the collection of items you want to appear in the dropdown list.
3. Set the `TextField` and `ValueField` properties to point to the corresponding names of the model.
4. [Bind the value of the component](https://www.telerik.com/blazor-ui/documentation/common-features/data-binding/overview#data-binding-vs-value-binding) to a variable of the same type as the type defined in the `ValueField` parameter.
5. (optional) Set the `Value` property to the initial value of the model.

> caption DropDownList [data binding](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind), two-way value binding, and main features

<demo metaUrl="client/dropdownlist/overview/" height="380"></demo>

## Data Binding

The Blazor DropDownList requires a data source so that it can populate the dropdown with data. To provide a data source, use the `Data` property. [Read more about the Blazor DropDownList data binding...](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind).

## Filtering

The Blazor DropDownList has a built-in filter that narrows down the shown suggestions as the end-user types. To configure this feature, use the `Filterable` parameter. Additionally, you can choose between different filter operators and configure after how many symbols the list with suggestions will appear. [Read more about the Blazor DropDownList filter...](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/filter).

## Grouping

The Blazor DropDownList enables you to group the listed suggestions into categories so you can help the end-user to browse faster through longer lists. [Read more about the Blazor DropDownList grouping...](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/grouping).

## Templates

You can use the functionality of the built-in templates and customize the default rendering of the component. [Read more about the Blazor DropDownList templates...](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/templates).

## Validation

You can ensure that the component value is acceptable by using the built-in validation. [Read more about input validation...](https://www.telerik.com/blazor-ui/documentation/common-features/input-validation).

## Virtualization

By virtualizing the elements in the dropdown, you can use huge data sources without performance issues. The UI virtualization works with both local and remote data. [Read more about the Blazor DropDownList virtualization...](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/virtualization)

## Adaptive Rendering

<demo metaUrl="client/dropdownlist/adaptive/" height="420"></demo>

The component supports different popup rendering depending on the screen size. [Read more about the Adaptive Rendering functionality and how to enable it...](https://www.telerik.com/blazor-ui/documentation/common-features/adaptive-rendering)

## DropDownList Parameters

> caption The Blazor dropdown list provides various parameters that allow you to configure the component:

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter                | Type                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AdaptiveMode`           | `AdaptiveMode` <br /> (`None`)               | The [adaptive mode](https://www.telerik.com/blazor-ui/documentation/common-features/adaptive-rendering) of the component.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `Data`                   | `IEnumerable<TItem>`                         | Allows you to provide the data source. Required.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `DefaultText`            | `string`                                     | Simple hint to be displayed when no item is selected yet. In order for it to be shown, the `Value` parameter should be set to a default value depending on the type defined in the `ValueField` parameter. For example, `0` for an `int`, and `null` for an `int?` or `string`. You need to make sure that it does not match the value of an existing item in the data source. See the first example in the [Examples section](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/overview#examples) in this article and in the [Input Validation](https://www.telerik.com/blazor-ui/documentation/common-features/input-validation#dropdownlist) article. |
| `Enabled`                | `bool`                                       | Whether the component is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `ReadOnly`               | `bool`                                       | If set to `true`, the component will be readonly and will not allow user input. The component is not readonly by default and allows user input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `Filterable`             | `bool`                                       | Whether [filtering](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/filter) is enabled for the end user.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `FilterDebounceDelay`    | `int` <br/> 150                              | Time in milliseconds between the last typed symbol and the filter input value update. Applicable to filtering only. Use it to balance between client-side performance and number of database queries.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `FilterOperator`         | `StringFilterOperator` <br /> (`StartsWith`) | The method of [filtering](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/filter) the items.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `FilterPlaceholder`      | `string`                                     | The hint that will be displayed in the filter input when it has no value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `Id`                     | `string`                                     | The `id` attribute rendered on the main wrapping element of the component (`<span class="k-dropdownlist">`). You can use it to attach a `<label for="">` to it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `InputMode`              | `string`                                     | The [`inputmode` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) of the `<input />` element.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `TItem`                  | `Type`                                       | The type of the model to which the component is bound. Required if you can't provide `Data` or `Value`. Determines the type of the reference object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `TValue`                 | `Type`                                       | The type of the value field from the model to which the component is bound. Required if you can't provide `Data` or `Value`. Determines the type of the reference object. The type of the values can be:<br /> - `number` (such as `int`, `double`, and so on)<br /> - `string`<br /> - `Guid`<br /> - `Enum`                                                                                                                                                                                                                                                                                                                                                                   |
| `Title`                  | `string`                                     | The title text rendered in the header of the dropdown list popup (action sheet). Applicable only when [`AdaptiveMode` is set to `Auto`](https://www.telerik.com/blazor-ui/documentation/common-features/adaptive-rendering).                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `TabIndex`               | `int?`                                       | The `tabindex` attribute rendered on the dropdown list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `TextField`              | `string` <br /> (`Text`)                     | The name of the field from the model that will be shown to the user.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `ValueField`             | `string` <br /> (`Value`)                    | The name of the field from the model that will be the underlying `value`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `Value` and `bind-Value` | `TValue`                                     | Gets/sets the value of the component, can be used for binding. If you set it to a value allowed by the model class value field, the corresponding item from the data collection will be pre-selected. Use the `bind-Value` syntax for two-way binding, for example, to a variable of your own.                                                                                                                                                                                                                                                                                                                                                                                  |

### Styling and Appearance

The following parameters enable you to customize the [appearance](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/appearance) of the Blazor DropDownList component:

| Parameter | Type     | Description                                                                                                                                                                                                                                                                                                                                                    |
| --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Class`   | `string` | The CSS class that will be rendered on the main wrapping element of the component. Use it to [override the theme or apply custom styles](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/override-theme-styles).                                                                                                                            |
| `Width`   | `string` | The width of the component. It will target both the dropdown and the main element if the dropdown has no specific width set. The default `Width` value is null, but the theme applies `100%`. Use the `Width` property or custom CSS to set another value [in any supported unit](https://www.telerik.com/blazor-ui/documentation/common-features/dimensions). |

> tip To learn more about the appearance, anatomy, and accessibility of the DropDownList, visit the [Progress Design System Kit documentation](https://www.telerik.com/design-system/docs/components/dropdownlist/)—an information portal offering rich component usage guidelines, descriptions of the available style variables, and globalization support details.

### Popup Settings

The DropDownList exposes settings for its dropdown (popup). To configure the options, declare a  `<DropDownListPopupSettings>` tag inside a `<DropDownListSettings>` tag:

<demo metaUrl="client/dropdownlist/popup-settings/" height="300"></demo>

The DropDownList provides the following popup settings:

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter           | Type                        | Description                                                                                                                                                                                                                                                                                                                             |
| ------------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AnimationDuration` | `int` <br /> (`300`)        | The dropdown animation duration in milliseconds.                                                                                                                                                                                                                                                                                        |
| `Class`             | `string`                    | Additional CSS class to customize the appearance of the popup.                                                                                                                                                                                                                                                                          |
| `Height`            | `string` <br /> (`"200px"`) | The height of the popup. If set to `"auto"`, the component will automatically adjust the popup height based on the number of items and available space. <br /> Setting `MaxHeight` disables the built-in screen boundary detection. This means that the component will no longer adjust the dropdown height to fit within the viewport. |
| `MinHeight`         | `string`                    | The minimum height of the popup.                                                                                                                                                                                                                                                                                                        |
| `MinWidth`          | `string`                    | The minimum width of the popup.                                                                                                                                                                                                                                                                                                         |
| `MaxHeight`         | `string`                    | The maximum height of the popup.                                                                                                                                                                                                                                                                                                        |
| `MaxWidth`          | `string`                    | The maximum width of the popup.                                                                                                                                                                                                                                                                                                         |
| `Width`             | `string`                    | The width of the popup. If you don't specify a value, the dropdown width will match the anchor element width which can help with responsive layouts and 100% widths.                                                                                                                                                                    |

The parameters that modify the popup dimensions (`Height`, `Width`, `MaxWidth`, etc.) expect [valid CSS values](https://www.telerik.com/blazor-ui/documentation/common-features/dimensions).

The `MinHeight` and `MaxHeight` have no effect if the `Height` is always within their range. The min and max values are useful only when the dropdown height is set to a relative unit or changes at runtime.

> If the **Virtualization** feature is enabled, it's important to note that the **auto** popup width functionality doesn't work as expected. In this scenario, the dropdown popup width does not dynamically adjust based on the data items. When dealing with virtualization and long items, specifying a fixed popup `Width` becomes imperative. For example, set a fixed width like `"300px"`. To determine this fixed width value, you can identify the longest item in the dropdown collection and calculate the required pixel width based on it.

## DropDownList Reference and Methods

Add a reference to the component instance to use the [DropDownList's methods](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikdropdownlist-2). Note that the [DropDownList is a generic component](https://www.telerik.com/blazor-ui/documentation/common-features/data-binding/overview#component-type).

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Method       | Description                                                                                                                                                                                                                                                                                                  |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Close`      | Closes the popup.                                                                                                                                                                                                                                                                                            |
| `FocusAsync` | Focuses the main element of the component. Always `await` this call, as it relies on `JSInterop`. Also check the dedicated KB article about [programmatic input component focusing](https://www.telerik.com/blazor-ui/documentation/knowledge-base/inputs-set-focus), which provides more examples and tips. |
| `Open`       | Opens the popup.                                                                                                                                                                                                                                                                                             |
| `Refresh`    | Re-renders the component popup.                                                                                                                                                                                                                                                                              |

<demo metaUrl="client/dropdownlist/methods/" height="250"></demo>

## Selected Item and DefaultText

By default, if no `Value` is provided and no `DefaultText` is defined, the DropDownList will appear empty.

* To display `DefaultText` - `Value` should be `0` or `null` depending on the data type you are using in the `ValueField` and the `DefaultText` should be defined.

* To display a selected item when the component renders - provide the `Value` of the desired element. Note that it must match an item of the component's data source.

## Examples

> caption Default text (hint) to show when no actual item is selected

<demo metaUrl="client/dropdownlist/default-text/" height="300"></demo>

> caption Get selected item from external code

<demo metaUrl="client/dropdownlist/selected-item/" height="300"></demo>

> tip If you are looking for more fields from the view-model that describes the dropdown items, not just the `Value`, see the [Get model from dropdown](https://www.telerik.com/blazor-ui/documentation/knowledge-base/dropdowns-get-model) KB article and the [OnChange](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onchange) event.
>
> You may also want to review/join the discussion and Vote for this request: <a href="https://www.telerik.com/forums/binding-dropdownlist-value-to-complex-model" target="_blank">Binding DropDownList Value to complex model</a>

## Next Steps

* [Binding the DropDownList to Data](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind)
* [Pre-Selecting Items for the User](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/pre-select-item)

## See Also

* [Data Binding](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind)
* [DropDownList API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikdropdownlist-2)
* [Live Demo: DropDownList](https://demos.telerik.com/blazor-ui/dropdownlist/overview)
* [Live Demo: DropDownList Validation](https://demos.telerik.com/blazor-ui/dropdownlist/validation)
