BlazorDrop 2.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package BlazorDrop --version 2.0.3
                    
NuGet\Install-Package BlazorDrop -Version 2.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorDrop" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorDrop" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="BlazorDrop" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlazorDrop --version 2.0.3
                    
#r "nuget: BlazorDrop, 2.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlazorDrop@2.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlazorDrop&version=2.0.3
                    
Install as a Cake Addin
#tool nuget:?package=BlazorDrop&version=2.0.3
                    
Install as a Cake Tool

.NET 6 .NET 8

BlazorDrop

BlazorDrop is a lightweight Blazor component library that provides customizable dropdowns with async loading, search, and virtualization support.

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
  • Two-way data binding support (@bind-Value)
  • Custom display selector
  • Loading indicator while fetching data
  • Disabled state support
  • Custom item templates
  • Optional placeholder text
  • Centralized JS Interop Service

Installation

You can install the library via NuGet:

dotnet add package BlazorDrop

Required Imports

Starting from this version, BlazorDrop requires DI registration for internal JS interop services.

Add the following line in Program.cs:

using BlazorDrop.Extensions;

builder.Services.AddBlazorDrop();

To use templates, make sure you import the following namespaces in your .razor file or _Imports.razor:

@using BlazorDrop
@using BlazorDrop.Components
//if loading bars required
@using BlazorDrop.Components.Loading

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

Select

<BlazorDropSelect
        T="SelectItem"
        DisplaySelector="@(x => x.Text)"
        OnLoadItemsAsync="LoadPageAsync"
        SearchAsync="SearchAsync"
        @bind-Value="@_selectedItem"
        ShowLoadingIndicator="true"
        Disabled="false"
        Placeholder="Select value"
        UpdateSearchDelayInMilliseconds="600"
        PageSize="10"
        ValueNotFoundMessageText="Not found" />

Parameters

Parameter Type Description
T generic Type of the items
Id string Optional unique ID (auto-generated)
Class string Optional CSS class
Style string Optional inline CSS
Placeholder string Placeholder text
ValueNotFoundMessageText string Message when no items found
PageSize int Items per page (default: 20)
CurrentPage int Initial page index
UpdateSearchDelayInMilliseconds int Search debounce delay (ms)
Value T Selected value
ValueChanged EventCallback<T> Triggered when value changes
OnItemClickAsync Func<T, Task<T>> Optional custom selection logic
ItemTemplate RenderFragment<T> Custom item template
DisplaySelector Func<T, string> Display text selector
OnLoadItemsAsync Func<int, int, Task<IEnumerable<T>>> Paged data loader
SearchAsync Func<string, Task<IEnumerable<T>>> Search handler
ShowLoadingIndicator bool Show loading spinner
Disabled bool Disable interaction

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.

List

<BlazorDropList
        T="SelectItem"
        DisplaySelector="@(x => x.Text)"
        OnLoadItemsAsync="LoadPageAsync"
        @bind-Value="@_selectedItem"
        ShowLoadingIndicator="true"
        PageSize="10" />

Parameters

Parameter Type Description
T generic Type of the items
Id string Optional unique ID (auto-generated)
Class string Optional CSS class
Style string Optional inline CSS
ValueNotFoundMessageText string Message shown when list is empty
PageSize int Items per page (default: 20)
CurrentPage int Initial page index
Value T Currently highlighted item
ValueChanged EventCallback<T> Triggered when an item is selected
OnItemClickAsync Func<T, Task<T>> Custom logic on item click
ItemTemplate RenderFragment<T> Custom item template
DisplaySelector Func<T, string> Display text selector
OnLoadItemsAsync Func<int, int, Task<IEnumerable<T>>> Paged data loader
ShowLoadingIndicator bool Show loading spinner

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 | IList<T> | List of selected items | | MaxDisplayedTags | int | Max tags before summary (Default: 3) | | SelectedItemsTextFormat | string | Summary text format (default: "Selected: {0}") | | GetDisplayTextAsync | Func<IEnumerable<T>, Task<string>> | Custom logic for input text display |

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 - loading bar to indicate data loading.

Parameters

Parameter Type Description
Id string Optional unique identifier
Class string Optional CSS class
Style string Optional inline CSS style

.NET Compatibility

BlazorDrop Version Supported .NET Versions
< 2.0.0 .NET Core 3.1
≥ 2.0.0 .NET 6, .NET 8
.NET 7, .NET 9, .NET 10 (not tested, potentially works)
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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