Class RadzenListBox<TValue>
A list box component that displays a scrollable list of items with single or multiple selection support. RadzenListBox provides an always-visible alternative to dropdowns, ideal for showing multiple options without requiring a popup. Displays all items in a scrollable container, making all options visible at once (unlike dropdowns which hide options in a popup). Supports single selection (default) or multiple selection via Multiple property, built-in search/filter with configurable operators and case sensitivity, binding to any IEnumerable data source with TextProperty and ValueProperty, custom item templates for rich list item content, efficient rendering of large lists via IQueryable support, optional "Select All" checkbox for multiple selection mode, and keyboard navigation (Arrow keys, Page Up/Down, Home/End) for accessibility. Use when you want to show all available options without requiring clicks to open a dropdown, or when multiple selection is needed and checkboxes would take too much space.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenListBox<TValue> : DropDownBase<TValue>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the selected value. Can be a single value or IEnumerable for multiple selection. |
Examples
Basic list box:
<RadzenListBox @bind-Value=@selectedId TValue="int" Data=@countries TextProperty="Name" ValueProperty="Id" Style="height: 300px;" />
Multiple selection with Select All:
<RadzenListBox @bind-Value=@selectedIds TValue="IEnumerable<int>" Multiple="true" SelectAllText="Select All"
Data=@items TextProperty="Name" ValueProperty="Id" Style="height: 400px;" />
Constructors
RadzenListBox()
A list box component that displays a scrollable list of items with single or multiple selection support. RadzenListBox provides an always-visible alternative to dropdowns, ideal for showing multiple options without requiring a popup. Displays all items in a scrollable container, making all options visible at once (unlike dropdowns which hide options in a popup). Supports single selection (default) or multiple selection via Multiple property, built-in search/filter with configurable operators and case sensitivity, binding to any IEnumerable data source with TextProperty and ValueProperty, custom item templates for rich list item content, efficient rendering of large lists via IQueryable support, optional "Select All" checkbox for multiple selection mode, and keyboard navigation (Arrow keys, Page Up/Down, Home/End) for accessibility. Use when you want to show all available options without requiring clicks to open a dropdown, or when multiple selection is needed and checkboxes would take too much space.
Declaration
public RadzenListBox()
Examples
Basic list box:
<RadzenListBox @bind-Value=@selectedId TValue="int" Data=@countries TextProperty="Name" ValueProperty="Id" Style="height: 300px;" />
Multiple selection with Select All:
<RadzenListBox @bind-Value=@selectedIds TValue="IEnumerable<int>" Multiple="true" SelectAllText="Select All"
Data=@items TextProperty="Name" ValueProperty="Id" Style="height: 400px;" />
Properties
InputAttributes
Specifies additional custom attributes that will be rendered by the input.
Declaration
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The attributes. |
ItemRender
Gets or sets the row render callback. Use it to set row attributes.
Declaration
[Parameter]
public Action<ListBoxItemRenderEventArgs<TValue>> ItemRender { get; set; }
Property Value
| Type | Description |
|---|---|
| Action<ListBoxItemRenderEventArgs<TValue>> | The row render callback. |
ReadOnly
Gets or sets a value indicating whether is read only.
Declaration
[Parameter]
public bool ReadOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
SelectAllText
Gets or sets the select all text.
Declaration
[Parameter]
public string SelectAllText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The select all text. |
Methods
BuildRenderTree(RenderTreeBuilder)
A list box component that displays a scrollable list of items with single or multiple selection support. RadzenListBox provides an always-visible alternative to dropdowns, ideal for showing multiple options without requiring a popup. Displays all items in a scrollable container, making all options visible at once (unlike dropdowns which hide options in a popup). Supports single selection (default) or multiple selection via Multiple property, built-in search/filter with configurable operators and case sensitivity, binding to any IEnumerable data source with TextProperty and ValueProperty, custom item templates for rich list item content, efficient rendering of large lists via IQueryable support, optional "Select All" checkbox for multiple selection mode, and keyboard navigation (Arrow keys, Page Up/Down, Home/End) for accessibility. Use when you want to show all available options without requiring clicks to open a dropdown, or when multiple selection is needed and checkboxes would take too much space.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |
Overrides
OnAfterRenderAsync(bool)
Called when [after render asynchronous].
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | firstRender | if set to |
Returns
| Type | Description |
|---|---|
| Task | Task. |
Overrides
OnKeyDown(KeyboardEventArgs)
Handles the KeyDown event.
Declaration
protected Task OnKeyDown(KeyboardEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyboardEventArgs | args | The KeyboardEventArgs instance containing the event data. |
Returns
| Type | Description |
|---|---|
| Task |
SelectAll()
Selects all.
Declaration
protected override Task SelectAll()
Returns
| Type | Description |
|---|---|
| Task |
Overrides
SetParametersAsync(ParameterView)
Set parameters as an asynchronous operation.
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters | The parameters. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |