Component

BOBInputDropdown

Single and multiple select list with keyboard navigation, search, and strongly-typed values. Options are declared as children.

API reference ↗

Basic usage

Single selection
Multiple selection
RAZOR
<BOBInputDropdown @bind-Value="_basicSingle" Label="Single" HelperText="Single selection">
    <DropdownOption TOption="int" Value="1">Option 1</DropdownOption>
    <DropdownOption TOption="int" Value="2">Option 2</DropdownOption>
    <DropdownOption TOption="int" Value="3">Option 3</DropdownOption>
    <DropdownOption TOption="int" Value="4">Option 4</DropdownOption>
</BOBInputDropdown>

<BOBInputDropdown @bind-Value="_basicMulti" Label="Multi" HelperText="Multiple selection">
    <DropdownOption TOption="int" Value="1">Option 1</DropdownOption>
    <DropdownOption TOption="int" Value="2">Option 2</DropdownOption>
    <DropdownOption TOption="int" Value="3">Option 3</DropdownOption>
    <DropdownOption TOption="int" Value="4">Option 4</DropdownOption>
</BOBInputDropdown>

Variants

RAZOR
<BOBInputDropdown @bind-Value="_outlinedValue"
                  Label="Outlined"
                  Variant="BOBInputVariant.Outlined">
    @foreach (string option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_filledValue"
                  Label="Filled"
                  Variant="BOBInputVariant.Filled">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_standardValue"
                  Label="Standard"
                  Variant="BOBInputVariant.Standard">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>

Sizes

RAZOR
<BOBInputDropdown @bind-Value="_smallValue" Label="Small" Size="BOBSize.Small">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_mediumValue" Label="Medium (Default)" Size="BOBSize.Medium">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_largeValue" Label="Large" Size="BOBSize.Large">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>

Color & Background

RAZOR
<BOBInputDropdown @bind-Value="_colorValue" Label="Custom Color & Background" Color="@PaletteColor.Secondary" BackgroundColor="@PaletteColor.SecondaryContrast">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>

Box Placement

Placement supports Top, Bottom, TopStart, TopEnd, BottomStart, BottomEnd or Auto

Auto mode will position the box in the bottom if it has space. Otherwise it will position the box on top.

RAZOR
<BOBInputDropdown @bind-Value="_bottomValue"
                  Label="Bottom Placement (Default)"
                  Placement="DropdownPlacement.Bottom">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_topValue"
                  Label="Top Placement"
                  Placement="DropdownPlacement.Top">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_autoValue"
                  Label="Auto Placement"
                  Placement="DropdownPlacement.Auto">
    @foreach (var option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>

Searchable

Set Searchable to filter options by typing.

RAZOR
<BOBInputDropdown TValue="string" @bind-Value="_searchable" Label="Country" Searchable="true" SearchPlaceholder="Type a country...">
    <DropdownOption TOption="string" Value="@("us")">United States</DropdownOption>
    <DropdownOption TOption="string" Value="@("mx")">Mexico</DropdownOption>
    <DropdownOption TOption="string" Value="@("ca")">Canada</DropdownOption>
    <DropdownOption TOption="string" Value="@("br")">Brazil</DropdownOption>
    <DropdownOption TOption="string" Value="@("ar")">Argentina</DropdownOption>
    <DropdownOption TOption="string" Value="@("es")">Spain</DropdownOption>
    <DropdownOption TOption="string" Value="@("fr")">France</DropdownOption>
    <DropdownOption TOption="string" Value="@("de")">Germany</DropdownOption>
    <DropdownOption TOption="string" Value="@("uk")">United Kingdom</DropdownOption>
    <DropdownOption TOption="string" Value="@("jp")">Japan</DropdownOption>
</BOBInputDropdown>

Custom template when there are not items.

RAZOR
<BOBInputDropdown TValue="string"
                  @bind-Value="_noOptionsValue"
                  Label="Empty Dropdown">
    <NoOptionsTemplate>
        <span>No items available</span>
    </NoOptionsTemplate>
</BOBInputDropdown>

Shadow

RAZOR
<BOBInputDropdown @bind-Value="_shadowValue" Variant="BOBInputVariant.Outlined" Label="Elevation Shadow"
                  Shadow="@BOBShadowPresets.Elevation(2)">
    @foreach (string option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_shadowValue" Variant="BOBInputVariant.Outlined" Label="Custom Shadow"
                  Shadow="@(ShadowStyle.Create(5, 10, 0.14f, color: "purple"))">
    @foreach (string option in _optionsStrings)
    {
        <DropdownOption Value="@option" Text="@option" />
    }
</BOBInputDropdown>

States

Required
Disabled
ReadOnly
RAZOR
<BOBInputDropdown @bind-Value="_requiredValue" Label="Required" Required="true" HelperText="Required">
    <DropdownOption TOption="int" Value="1">Option 1</DropdownOption>
    <DropdownOption TOption="int" Value="2" Disabled="true">Option 2</DropdownOption>
    <DropdownOption TOption="int" Value="3" Disabled="true">Option 3</DropdownOption>
    <DropdownOption TOption="int" Value="4">Option 4</DropdownOption>
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_disabledValue" Label="Disabled" Disabled="true" HelperText="Disabled">
    <DropdownOption TOption="int" Value="1">Option 1</DropdownOption>
    <DropdownOption TOption="int" Value="2" Disabled="true">Option 2</DropdownOption>
    <DropdownOption TOption="int" Value="3" Disabled="true">Option 3</DropdownOption>
    <DropdownOption TOption="int" Value="4">Option 4</DropdownOption>
</BOBInputDropdown>
<BOBInputDropdown @bind-Value="_readOnlyValue" Label="Read Only" ReadOnly="true" HelperText="ReadOnly">
    <DropdownOption TOption="int" Value="1">Option 1</DropdownOption>
    <DropdownOption TOption="int" Value="2" Disabled="true">Option 2</DropdownOption>
    <DropdownOption TOption="int" Value="3" Disabled="true">Option 3</DropdownOption>
    <DropdownOption TOption="int" Value="4">Option 4</DropdownOption>
</BOBInputDropdown>

Disabled options

RAZOR
<BOBInputDropdown TValue="int?" @bind-Value="_disabledOptionValue" Label="With disabled options">
    <DropdownOption TOption="int" Value="1">Option 1</DropdownOption>
    <DropdownOption TOption="int" Value="2" Disabled="true">Option 2</DropdownOption>
    <DropdownOption TOption="int" Value="3" Disabled="true">Option 3</DropdownOption>
    <DropdownOption TOption="int" Value="4">Option 4</DropdownOption>
</BOBInputDropdown>

Properties

29 rows.
PropertyTypeDefaultDescription
ValueTValue?Current value of the dropdown.
ValueChangedEventCallback<TValue>Raised when the selected value changes.
ValueExpressionExpression<Func<TValue>>?Expression used to identify the bound value for validation.
VariantBOBInputVariantBOBInputVariant.OutlinedVisual variant of the input field.
SizeBOBSizeBOBSize.MediumVisual size of the dropdown.
FullWidthboolWhen , the dropdown spans the full width of its container.
DisabledboolWhen , the dropdown is non-interactive.
IsLoadingboolWhen , the dropdown shows a loading indicator.
LoadingIndicatorVariantBOBLoadingIndicatorVariant?Variant of the loading indicator shown when is .
RequiredboolWhen , a value must be selected.
ReadOnlyboolWhen , the value cannot be changed.
DensityBOBDensityBOBDensity.StandardVertical density (gap) of the input.
ShadowShadowStyle?Shadow style applied to the input container.
Colorstring?Text color of the dropdown. Accepts any valid CSS color value.
BackgroundColorstring?Background color of the dropdown. Accepts any valid CSS color value.
ChildContentRenderFragment?Content rendered inside the dropdown, typically &lt;BOBOption&gt; items.
Placeholderstring?Placeholder text shown when no option is selected.
Labelstring?Floating label displayed above the input when a value is selected or focused.
HelperTextstring?Helper text displayed below the input for additional context.
CloseOnSelectbooltrueWhen , the menu closes after selecting an option.
PlacementDropdownPlacementDropdownPlacement.AutoPreferred placement of the dropdown menu relative to the input.
SearchableboolWhen , a search box is rendered at the top of the menu.
SearchPlaceholderstring"Search..."Placeholder text for the search box.
SearchModeSearchModeSearchMode.SmartAlgorithm used to filter options while searching.
ShowSelectAllbooltrueWhen and in multi-select mode, shows buttons to select or deselect all options.
SelectAllTextstring"Select All"Label of the "Select All" button.
DeselectAllTextstring"Deselect All"Label of the "Deselect All" button.
NoOptionsTemplateRenderFragment?Custom template rendered when the dropdown has no options.
NoResultsTemplateRenderFragment<NoResultsContext>?Custom template rendered when a search yields no results.