Select
Dropdown select for choosing a single value from a list of options; requires PopoverProvider in layout.
Installation
Add the Select component using the CLI:
Features
RenderItem) and sizing/layout options (Size, PopoverFitContent, MaxVisibleItems)@bind-Value, ValueChanged)Items or declarative childrenExamples
Usage
The Select component displays a dropdown for choosing a single value from a list. Use Value and ValueChanged (or @bind-Value) for two-way binding. Provide Items as a collection of SelectOption<T>. Use new SelectOption<T>(value, text, Disabled: true) to disable individual items. Requires PopoverProvider in your layout (already present in the docs).
Declarative
Use child components when you want to declare options inline. SelectItem, SelectLabel, SelectSeparator, and SelectGroup map to the same selection/keyboard/scroll behavior as the Items mode.
API Reference
Select`1
Dropdown select component for choosing a single value from a list of options.
Properties
| Name | Type | Description |
|---|---|---|
AdditionalAttributes |
Dictionary<string, Object> |
|
ChildContent |
RenderFragment |
|
Class |
string |
|
Disabled |
bool |
|
Items |
IEnumerable<SelectOption<T>> |
|
Label |
string |
Optional label displayed at the top of the dropdown content and used as the trigger aria-label. |
LockScroll |
bool |
When true, body scroll is locked while the popover is open. |
MaxVisibleItems |
Nullable<int> |
|
Placeholder |
string |
Placeholder text shown when no value is selected. |
PopoverFitContent |
bool |
When true, the popover expands to fit the width of its option content instead of matching the trigger width. |
RenderItem |
RenderFragment<SelectOption<T>> |
|
Size |
Size |
Size variant applied to the trigger. |
TriggerClass |
string |
Additional CSS classes applied to the trigger element. |
Value |
T |
Currently selected value. |
ValueChanged |
EventCallback<T> |
Callback invoked when the selected value changes. |
Events
| Name | Type | Description |
|---|---|---|
ValueChanged |
EventCallback<T> |
Callback invoked when the selected value changes. |
Methods
| Method | Returns | Description |
|---|---|---|
DisposeAsync |
ValueTask |
|
Equals |
bool |
|
GetHashCode |
int |
|
GetType |
Type |
|
SetParametersAsync |
Task |
|
ToString |
string |