BlazorDrop 2.0.2
See the version list below for details.
dotnet add package BlazorDrop --version 2.0.2
NuGet\Install-Package BlazorDrop -Version 2.0.2
<PackageReference Include="BlazorDrop" Version="2.0.2" />
<PackageVersion Include="BlazorDrop" Version="2.0.2" />
<PackageReference Include="BlazorDrop" />
paket add BlazorDrop --version 2.0.2
#r "nuget: BlazorDrop, 2.0.2"
#:package BlazorDrop@2.0.2
#addin nuget:?package=BlazorDrop&version=2.0.2
#tool nuget:?package=BlazorDrop&version=2.0.2
BlazorDrop
BlazorDrop is a lightweight and flexible Blazor component library for building searchable, lazy-loaded dropdowns with support for virtual scrolling, async filtering, custom templates, and both single- and multi-select modes.
Features
- Asynchronous data loading by pages
- Search by input text with debounce
- Scroll-to-end detection for infinite loading
- Multi-select support with dynamic list rendering
- Value change binding
- Custom display selector
- Loading indicator while fetching data
- Disabled state support
- Designed for .NET Core 3.1
- Custom item templates
Installation
You can install the library via NuGet:
dotnet add package BlazorDrop
Required Imports
To use templates, make sure you import the following namespaces in your .razor file or _Imports.razor:
@using BlazorDrop
@using BlazorDrop.Components
Then reference the JavaScript and CSS in your host page:
- For Blazor WebAssembly:
wwwroot/index.html - For Blazor Server:
_Host.cshtml
<script src="_content/BlazorDrop/BlazorDropSelect.js"></script>
<link rel="stylesheet" href="_content/BlazorDrop/BlazorDropSelect.css" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
rel="stylesheet"
/>
Usage
BlazorDropSelect
<BlazorDropSelect
T="KeyValuePair<Guid, string>"
DisplaySelector="@(x => x.Value)"
OnLoadItemsAsync="LoadPageAsync"
OnSearchAsync="SearchForItemAsync"
OnItemClickAsync="OnValueChanged"
ShowLoadingIndicator="true"
Disabled="false"
Placeholder="Select value"
UpdateSearchDelayInMilliseconds="600"
PageSize="10"
ValueNotFoundMessageText="Not fount"
Class="active-select"
Id="select-enabled"
CurrentPage="@(0)"
Value="@_selectedItem" />
Parameters
| Parameter | Type | Description |
|---|---|---|
T |
generic |
Type of the items in the dropdown |
Id |
string |
Optional unique ID (auto-generated by default) |
Class |
string |
Optional CSS class for the component |
Style |
string |
Optional inline CSS style applied to the container |
Placeholder |
string |
Placeholder text when nothing is selected |
ValueNotFoundMessageText |
string |
Message shown when no matching value is found |
PageSize |
int |
Number of items to load per page (default: 20) |
CurrentPage |
int |
Initial page index for paging (default: 0) |
UpdateSearchDelayInMilliseconds |
int |
Debounce delay for input search (default: 1000 ms) |
Value |
T |
Currently selected item / default value |
OnValueChangedAsync |
Func<T, Task<T>> |
Callback for selection change |
ItemTemplate |
RenderFragment<T> |
Optional custom template for each list item |
DisplaySelector |
Func<T, string> |
Function to extract display text from item |
OnLoadItemsAsync |
Func<int, int, Task<IEnumerable<T>>> |
Async method for loading paginated items |
OnSearchAsync |
Func<string, Task<IEnumerable<T>>> |
Async method for searching items by text |
ShowLoadingIndicator |
bool |
Show loading spinner during async operations |
Disabled |
bool |
Disables the input and interaction with the dropdown |
Example Code
private Dictionary<Guid, string> _testValues = new();
private KeyValuePair<Guid, string> _selectedItem;
protected override async Task OnInitializedAsync()
{
for (int i = 0; i < 1000; i++)
{
var id = Guid.NewGuid();
_testValues.Add(id, $"Record {i}");
}
}
private Task<IEnumerable<KeyValuePair<Guid, string>>> LoadPageAsync(int page, int pageSize)
{
return Task.FromResult(_testValues.Skip(page * pageSize).Take(pageSize));
}
private Task<IEnumerable<KeyValuePair<Guid, string>>> SearchForItemAsync(string text)
{
return Task.FromResult(_testValues.Where(x => x.Value.Contains(text)));
}
private Task<KeyValuePair<Guid, string>> OnValueChanged(KeyValuePair<Guid, string> item)
{
_selectedItem = item;
return Task.FromResult(item);
}
BlazorDropList
BlazorDropList is a Blazor component designed to render a virtualized, scrollable dropdown-style list that supports lazy loading and custom item display. It is styled according to Material Design principles.
<BlazorDropList
T="KeyValuePair<Guid, string>"
DisplaySelector="@(x => x.Value)"
OnLoadItemsAsync="LoadPageAsync"
OnItemClickAsync="OnValueChanged"
ShowLoadingIndicator="true"
PageSize="10"
ValueNotFoundMessageText="Not fount"
Class="drop-list"
Id="drop-list"
CurrentPage="@(0)"
Value="@_selectedItemInDisabledSelect">
</BlazorDropList>
Parameters
| Parameter | Type | Description |
|---|---|---|
T |
generic |
Type of the items rendered in the list |
Id |
string |
Optional unique identifier (auto-generated by default) |
Class |
string |
Optional CSS class for the list container |
Style |
string |
Optional inline CSS style applied to the container |
DisplaySelector |
Func<T, string> |
Function to extract display text from each item |
Value |
T |
Currently selected item |
PageSize |
int |
Number of items to load per page (default: 20) |
CurrentPage |
int |
Index of the initial page (default: 0) |
ItemTemplate |
RenderFragment<T> |
Optional custom template for each list item |
OnLoadItemsAsync |
Func<int, int, Task<IEnumerable<T>>> |
Async function for loading paginated items |
OnItemClickAsync |
Func<T, Task> |
Async callback triggered when an item is clicked |
ValueNotFoundMessageText |
string |
Message shown when no items are found |
ShowLoadingIndicator |
bool |
Whether to display a loading spinner during async data fetch |
Example Code
private Dictionary<Guid, string> _testValues = new();
private KeyValuePair<Guid, string> _selectedItem;
protected override async Task OnInitializedAsync()
{
for (int i = 0; i < 1000; i++)
{
var id = Guid.NewGuid();
_testValues.Add(id, $"Record {i}");
}
}
private Task<IEnumerable<KeyValuePair<Guid, string>>> LoadPageAsync(int page, int pageSize)
{
return Task.FromResult(_testValues.Skip(page * pageSize).Take(pageSize));
}
private Task<IEnumerable<KeyValuePair<Guid, string>>> SearchForItemAsync(string text)
{
return Task.FromResult(_testValues.Where(x => x.Value.Contains(text)));
}
private Task<KeyValuePair<Guid, string>> OnValueChanged(KeyValuePair<Guid, string> item)
{
_selectedItem = item;
return Task.FromResult(item);
}
BlazorDropMultiSelect
BlazorDropMultiSelect is an extension of BlazorDropSelect supporting multi-value selection with the same lazy-loading and searchable capabilities.
<BlazorDropMultiSelect
T="KeyValuePair<Guid, string>"
DisplaySelector="@(x => x.Value)"
OnLoadItemsAsync="LoadPageAsync"
OnSearchAsync="SearchForItemAsync"
OnItemClickAsync="OnMultiSelectChanged"
ShowLoadingIndicator="true"
Disabled="false"
Placeholder="Select values"
PageSize="10"
Class="multi-select"
Id="select-multi"
CurrentPage="@(0)"
SelectedValues="@_selectedItems" />
Parameters (additional to BlazorDropSelect):
| Parameter | Type | Description |
| ---------------- | ---------------- | -------------------------------------------------- |
| SelectedValues | IEnumerable<T> | List of selected items in multi-select mode |
| Style | string | Optional inline CSS style applied to the container |
Custom Item Template
You can customize how each dropdown item is rendered using the ItemTemplate parameter. This allows you to change formatting or apply custom styles.
<BlazorDropSelect T="KeyValuePair<Guid, string>"
Placeholder="With custom template"
Value="@_templatedSelect"
DisplaySelector="@(x => x.Value)"
OnLoadItemsAsync="LoadItemsPagedAsync"
OnSearchTextChangedAsync="SearchByTextAsync"
OnItemClickAsync="OnTemplateItemSelected"
ValueNotFoundMessageText="Not found">
<ItemTemplate Context="item">
<span class="text-success fw-semibold">@item.Value</span>
</ItemTemplate>
</BlazorDropSelect>
Notes
- ItemTemplate accepts a RenderFragment<T> where T is the item type.
- If specified, this replaces the default item rendering.
- You can apply Bootstrap or custom CSS styles inside the template.
Loading Indicator Components
BlazorDropCircularProgressBar and BlazorDropLinearProgressBar are a lightweight, reusable components that renders a Material-style loading bar to indicate asynchronous data loading.
Parameters
| Parameter | Type | Description |
|---|---|---|
Id |
string |
Optional unique identifier (auto-generated by default). |
Class |
string |
Optional CSS class for additional styling customization. |
Style |
string |
Optional inline CSS style applied to the container |
.NET Compatibility
| BlazorDrop Version | Supported .NET Versions |
|---|---|
| ≤ 1.0.6 | .NET Core 3.1 |
| ≥ 2.0.0 | .NET 6, .NET 8 |
| .NET 7, .NET 9 (not tested, potentially works) |
Notes
- Scroll detection triggers when the user reaches the bottom of the dropdown list.
- Click outside and scroll handlers are automatically attached and detached.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Components (>= 6.0.36)
- Microsoft.AspNetCore.Components.Web (>= 6.0.36)
- Microsoft.JSInterop (>= 6.0.36)
-
net8.0
- Microsoft.AspNetCore.Components (>= 6.0.36)
- Microsoft.AspNetCore.Components.Web (>= 6.0.36)
- Microsoft.JSInterop (>= 6.0.36)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.1.0 | 67 | 9/18/2026 |
| 2.0.3 | 99 | 12/31/2025 |
| 2.0.2 | 140 | 6/15/2025 |
| 2.0.1 | 130 | 6/7/2025 |
| 2.0.0 | 161 | 6/5/2025 |
| 1.1.0 | 55 | 9/18/2026 |
| 1.0.10 | 134 | 6/15/2025 |
| 1.0.9 | 128 | 6/7/2025 |
| 1.0.8 | 129 | 6/7/2025 |
| 1.0.6 | 168 | 6/5/2025 |
| 1.0.5 | 162 | 6/3/2025 |
| 1.0.4 | 168 | 6/3/2025 |
| 1.0.3 | 160 | 5/28/2025 |
| 1.0.2 | 89 | 5/24/2025 |
| 1.0.1 | 104 | 5/23/2025 |
| 1.0.0 | 107 | 5/23/2025 |
See full changelog: https://github.com/SetaSimo/BlazorDrop/blob/main/CHANGELOG.md