Inputs
Dropdown
BitDropdown (also known as Select, MultiSelect or ComboBox) lets users pick one or more options from a list that opens on demand. The callout is a real listbox that keeps its grouping, is searchable with typeahead, stays fully navigable with the keyboard and is announced to a screen reader, and it covers large datasets through virtualization and on-demand loading. The ComboBox mode adds free typing, chips, autocomplete and token separators, every part of the component is templatable, and in a form it offers EditForm validation alongside a hidden native select that carries the value into a plain HTML form post. Three sizes, boxed, borderless and underlined variants, a swipeable panel on small screens and RTL support round it out.
Notes
The BitDropdown is a Multi-API component
which can accept the list of Items in 3 different ways:
1. The BitDropdownItem class
2. A Custom Generic class
3. The BitDropdownOption component
Introduction
Music: Music Cocktails, Musician: AlexGuz, URL: https://open.spotify.com/artist/1u0Nlnljg2xGHJV6X7W4i1
Usage
Every example is live. Open its code to see exactly what produced the component running underneath.
Basic
Grouping
The grouping survives a search: the headers of the groups that still have a match stay above them, and only the ones left naming nothing — along with a divider that lost the items on one of its sides — go with the items they framed. A result that arrived as a flat list would take the grouping away exactly when the list is hardest to read, so the third example below keeps it while filtering.
Prefix & Suffix
FitWidth
Variants
Responsive
Drop direction
MaxHeight caps the scrollable item list at a height of your own, in pixels, so a long list stays a modest panel instead of stretching to whatever the viewport allows. It is applied on top of that available space rather than in place of it, so it can only ever make the list shorter — a dropdown near the bottom of the window is still limited by the room it actually has. Note that this is the one size a stylesheet cannot reach: the height is measured and written as an inline style every time the callout opens, so a CSS rule would always lose to it.
Clear button
ClearOnEscape gives the same clear to the keyboard, so taking back a selection does not require finding a button with the mouse. Escape stays a dismiss key first: it closes the callout, and in the ComboBox mode it drops the text that was typed into it, and only a press with nothing left to dismiss reaches the selection. It goes through the very same clear as the button, so it raises OnClear and is refused wherever the button would be — and it needs no ShowClearButton, so a dropdown that shows no clear button can still be cleared this way.
SearchBox
Search options
Immediate search
Validation
Customization
Binding
ValueComparer decides whether two values stand for the same selection, in place of the default equality of the value type. That is what a value which is not its own identity needs: a record or a class used as the value compares by reference by default, so a value arriving from a form, a query string or a fresh fetch would never match the item it names, however equal the two look. The example below uses a case-insensitive comparer, so the value F-APP selects the item whose value is f-app. The comparer governs every value comparison the component makes — which item a value selects, which chip a removal takes away, whether a typed term is already selected — so two values it calls equal are one and the same selection throughout. Finally, OnFocusIn and OnFocusOut follow the focus of the dropdown as a whole: they sit on the trigger and focusin/focusout bubble, so moving between the trigger and the ComboBox input inside it does not report a round trip through the outside.
ComboBox
Requiring the typed text to match an item exactly makes Enter a dead key for anyone who only typed the beginning of a name, so AutoSelectFirstMatch lets a partial term stand for the first item it matches: typing ban and pressing Enter then selects Banana. It takes precedence over the Dynamic mode below, so a term that names an item the list already has selects that item instead of creating a second one beside it.
Whichever item a commit would take — the one the typed text names exactly, or the first one it still matches under AutoSelectFirstMatch — is marked in the list as you type, so what Enter is about to select is visible before it is pressed rather than only afterwards. The same item is named to a screen reader through the aria-activedescendant of the input, so the cue is not a visual-only one. When nothing is marked, Enter either creates a new item (with Dynamic) or does nothing at all.
SelectTextOnFocus selects whatever is already in the input when it takes the focus, so coming back to a combo box that holds a term and typing replaces that term instead of appending to it — which is what a field the user returns to in order to look for something else needs. An empty input has nothing to select, and neither has a read-only one, where the selection would only be a highlight over text that cannot be changed.
Chips
ChipTemplate draws the content of a chip from the item it stands for, which is what turns a bare list of names into avatars, icons or colored categories. It replaces the text only: the remove button is still rendered after it, so a chip stays removable however it is drawn.
Selection display
AutoClearSearch covers the other half of a multi select session: the callout stays open after a pick, so by default the next item has to be found through the filter left over from the previous one. Enabling it clears the search text after every selection instead. HideSelectedItems goes one step further and drops the picked items out of the callout altogether, which makes sense when the chips already show what is selected and the list is only about what is left to choose. A group header whose items have all been picked goes with them, and so does a divider that lost the items on one of its sides, so the list never opens with a stray rule or ends on a group name with nothing under it.
Across all of them the selection is reported in the order it was made rather than in the order of the item list: the chips, the joined text and the overflow summary follow the order of Values, which grows as the user picks, so the Backspace of the ComboBox removes the chip that was added last.
Dynamic ComboBox
Keyboard navigation
Select all
Selection limit
Empty state
Loading
Virtualization
Localization
Icons
Close on select
Whichever way it goes, the focus follows: a callout that closes hands the focus back to the dropdown (or to its ComboBox input), so the keyboard is never left stranded on an element that has just been removed from the page, while a callout that stays open keeps the focus on the option that was picked, ready for the next arrow key.
Token separators
Open on focus
Description
Color
External Icons
Size
Style & Class
RTL
API
Every parameter, public member, sub-class and enum this component exposes.
BitDropdown parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AutoClearSearch | bool | false | Clears the typed search text after each selection in the multi select ComboBox mode, so the next item is picked from the full list instead of from the previous filter. |
| AutoFocus | bool | false | Gives the focus to the dropdown as soon as it is rendered. |
| AutoFocusSearchBox | bool | false | Enables auto-focusing of the SearchBox input when the callout is open. |
| AutoSelectFirstMatch | bool | false | Makes Enter in the ComboBox mode pick the first item the typed text matches when no item matches it exactly, which is what an autocomplete does: typing "app" and pressing Enter then selects "Apple" instead of doing nothing. It takes precedence over Dynamic, so a term that matches an existing item selects that item rather than creating a new one out of it. |
| CalloutFooterTemplate | RenderFragment? | null | Custom template to render as a footer in the callout. |
| CalloutHeaderTemplate | RenderFragment? | null | Custom template to render as a header in the callout. |
| CaretDownIcon | BitIconInfo? | null | The icon of the chevron down element. Takes precedence over CaretDownIconName when both are set. Use for external icon libraries (e.g. BitIconInfo.Fa("solid chevron-down"), BitIconInfo.Bi("chevron-down"), BitIconInfo.Css("my-class")). |
| CaretDownIconName | string? | null | The icon name of the chevron down element of the dropdown from the Fluent UI icon set. |
| CaretDownTemplate | RenderFragment? | null | The custom template for the chevron down element of the dropdown. |
| ChildContent | RenderFragment? | null | The content of the Dropdown, a list of BitDropdownOption components. |
| Chips | bool | false | Shows the selected items like chips in the BitDropdown. |
| ChipsRemoveButtonAriaLabel | string? | null | The composite format of the accessible name of the remove button of a chip, which receives the text of the item the chip stands for, for example "Remove {0}". Defaults to the English message. |
| ChipsRemoveIcon | BitIconInfo? | null | The icon of the remove button in the chips display. Takes precedence over ChipsRemoveIconName when both are set. |
| ChipsRemoveIconName | string? | null | The icon name of the remove button in the chips display from the Fluent UI icon set. |
| ChipTemplate | RenderFragment<TItem>? | null | The custom template for the content of a chip in the chips display, which receives the item the chip stands for. It replaces the text of the chip only; the remove button is still rendered after it. |
| Classes | BitDropdownClassStyles? | null | Custom CSS classes for different parts of the BitDropdown. |
| ClearButtonAriaLabel | string? | null | The accessible name (and the tooltip) of the clear button of the dropdown. Defaults to the English message. |
| ClearButtonIcon | BitIconInfo? | null | The icon of the clear button of the dropdown. Takes precedence over ClearButtonIconName when both are set. |
| ClearButtonIconName | string? | null | The icon name of the clear button of the dropdown from the Fluent UI icon set. |
| ClearOnEscape | bool | false | Makes the Escape key take back the whole selection once there is nothing left for it to dismiss: the first press closes the callout (and, in the ComboBox mode, drops the text that was typed into it), and only a press with the callout already closed and nothing typed clears what is selected. It reports itself through OnClear exactly as the clear button does, and it is refused in the same places that button is - a read-only dropdown, a one-way binding. |
| CloseOnSelect | bool? | null | Determines whether picking an item in the callout closes it. It defaults to the behavior each mode expects: a single select dropdown closes, because the pick is the whole interaction, while a multi select one stays open so the next item can be picked right away. Set it explicitly to keep a single select callout open (a long list the user keeps trying options from) or to close a multi select one after every pick. |
| Color | BitColor? | null | The general color of the dropdown. |
| Combo | bool | false | Activates the ComboBox feature in BitDropDown component. |
| ComboBoxAddButtonAriaLabel | string? | null | The accessible name (and the tooltip) of the add button in the responsive ComboBox mode. Defaults to the English message. |
| ComboBoxAddButtonIcon | BitIconInfo? | null | The icon of the add button in the responsive ComboBox mode. Takes precedence over ComboBoxAddButtonIconName when both are set. |
| ComboBoxAddButtonIconName | string? | null | The icon name of the add button in the responsive ComboBox mode from the Fluent UI icon set. |
| DefaultValues | IEnumerable<TValue?>? | null | The default values that will be initially used to set selected items in multi select mode if the Values parameter is not set. |
| DebounceTime | int | 0 | The debounce time in milliseconds for the search and combo box inputs (applied when Immediate is enabled). |
| Description | string? | null | The description rendered below the dropdown, which is also tied to it as its accessible description through aria-describedby. |
| DescriptionTemplate | RenderFragment? | null | The custom template for the description of the dropdown, which replaces Description and is tied to the dropdown in the same way. |
| DropDirection | BitDropDirection | BitDropDirection.TopAndBottom | Determines the allowed drop directions of the callout. |
| Dynamic | bool | false | It is allowed to add a new item in the ComboBox mode. While the typed text names no item the list offers to create one out of it. |
| DynamicItemTemplate | RenderFragment<string>? | null | The custom template for the row the callout offers to create a new item with in the Dynamic ComboBox mode, which receives the text the item would be created from. |
| DynamicItemTextFormat | string? | null | The composite format of the row the callout offers to create a new item with in the Dynamic ComboBox mode, which receives the text the item would be created from, for example "Add \"{0}\"". |
| DynamicValueGenerator | Func<TItem?, TValue>? | null | The function for generating value in a custom item when a new item is on added Dynamic ComboBox mode. |
| EmptyTemplate | RenderFragment? | null | The custom template to render in the callout when there is no item to show. |
| EmptyText | string? | null | The text to render in the callout when there is no item to show. |
| ExistsSelectedItemFunction | Func<ICollection<TItem>, string, bool>? | null | Decides whether the text committed in the ComboBox mode already stands for one of the selected items, in place of the default comparison of that text with the item texts, ignoring case. It receives the selected items and the committed text, and returning true stops the commit, so the same item cannot be selected (or created) twice under a name your data considers equivalent. |
| FindItemFunction | Func<ICollection<TItem>, string, TItem?>? | null | Finds the item the text committed in the ComboBox mode stands for, in place of the default comparison of that text with the item texts, ignoring case. It receives the items and the committed text; the item it returns gets selected, and only when it returns none does AutoSelectFirstMatch and then Dynamic get their turn. |
| FitWidth | bool | false | Enables fit-content value for the width of the root element. |
| HeaderTemplate | RenderFragment<TItem>? | null | The custom template for rendering the header items of the dropdown. |
| HideSelectedItems | bool | false | Removes the already selected items from the callout, which suits a multi select dropdown whose selection is visible as chips and whose list is therefore only about what is left to pick. A group header left naming nothing, and a divider left without items on one of its sides, are removed along with them. It has no effect when the items come from an ItemsProvider, which hands over the window it was asked for and is the only place that can leave the selected items out of it. |
| HighlightSearch | bool | false | Highlights the part of the item text that matched the current search text in the callout. Only applies to the default item rendering, not to a custom ItemTemplate. The highlighted part is found by the built-in algorithm (SearchMode and SearchIgnoreDiacritics), so a custom SearchFunction that matches by some other rule can produce items with nothing to highlight. |
| InitialSelectedItems | IEnumerable<TItem>? | null | The initial items that will be used to set selected items when using an ItemProvider. |
| Immediate | bool | false | Searches the items as the user types in the search box (based on the 'oninput' HTML event) instead of waiting for the search box to be committed. The ComboBox input always searches as it is typed, so there it only decides whether DebounceTime and ThrottleTime apply. |
| IsLoading | bool | false | Shows a loading indicator in the callout (and in place of the caret down element) while the items are being fetched. The dropdown stays interactive, so the user can still open the callout and see the loading state. |
| IsOpen | bool | false | Determines the opening state of the callout. (two-way bound) |
| ItemCheckIcon | BitIconInfo? | null | The icon of the check mark in the multi-select items. Takes precedence over ItemCheckIconName when both are set. |
| ItemCheckIconName | string? | null | The icon name of the check mark in the multi-select items from the Fluent UI icon set. |
| Items | ICollection<TItem>? | null | The list of items to display in the callout. |
| ItemSize | int | 35 | The height of each item in pixels for virtualization. |
| ItemsProvider | BitDropdownItemsProvider<TItem>? | null | The function providing items to the list for virtualization. It loads the items on demand, in the windows the user actually scrolls to, and receives the current search text so the filtering happens at the source instead of over an already loaded list. It requires Virtualize to be enabled, which is what requests the windows. |
| ItemsProviderDebounceTime | int | 100 | The delay in milliseconds before an ItemsProvider request is issued, which collapses the bursts of requests produced by fast scrolling and typing into a single one. |
| ItemTemplate | RenderFragment<TItem>? | null | The custom template for rendering the items of the dropdown. |
| Label | string? | null | The text of the label element of the dropdown. |
| LabelTemplate | RenderFragment? | null | The custom template for the label of the dropdown. |
| LoadingTemplate | RenderFragment? | null | The custom template to render in the callout in place of the items while IsLoading is enabled. |
| LoadingText | string? | null | The text to render in the callout in place of the items while IsLoading is enabled. Defaults to "Loading...". |
| MaxDisplayedItems | int? | null | The maximum number of selected items rendered in the dropdown itself. Beyond it, the chips display collapses the extra ones into an overflow indicator and the text display switches to a summary. Zero or null renders every selected item. |
| MaxHeight | int? | null | The maximum height of the scrollable item list of the callout in pixels. It is applied on top of the space the viewport leaves, so it can only ever make the list shorter. A value that is not greater than zero (and null) leaves the viewport alone to decide. |
| MaxSelectedItems | int? | null | The maximum number of items that can be selected in multi select mode. A value that is not greater than zero (and null) means no limit. |
| MaxSelectedItemsText | string? | null | The composite format of the message announced to screen readers once MaxSelectedItems is reached, which receives that limit, for example "Maximum of {0} items selected". Defaults to the English message. |
| MinSearchLength | int | 0 | The number of characters the search text must reach before the items get filtered. While the search text is shorter, the full list is shown and no search is performed. |
| MinSearchLengthText | string? | null | The composite format of the hint the callout shows while the typed text is still shorter than MinSearchLength, which receives the number of characters that are still missing, for example "Type {0} more characters to search". It is what tells the user that the list they are looking at is the full one rather than the result of what they typed, and it is announced to screen readers as well. Defaults to the English message; the hint is not shown at all while nothing has been typed, where the full list needs no explaining. |
| MultiSelect | bool | false | Enables the multi select mode. |
| MultiSelectDelimiter | string | , | The delimiter for joining the values to create the text of the dropdown in multi select mode. |
| Name | string? | null | The name of the hidden native select element that mirrors the selection, so the value takes part in a plain HTML form post. It is intended for use with forms and is not displayed in the UI. |
| NameSelectors | BitDropdownNameSelectors<TItem, TValue>? | null | Names and selectors of the custom input type properties. |
| NoBorder | bool | false | Removes the border from the root element. |
| NoResultsTemplate | RenderFragment? | null | The custom template to render in the callout when the current search has no result. Falls back to the EmptyTemplate when not set. |
| NoResultsText | string? | null | The text to render in the callout when the current search has no result. Falls back to the EmptyText when not set. |
| NoWrapNavigation | bool | false | Stops the arrow keys at the ends of the item list instead of letting them wrap around from the last item to the first one and back, which suits a long list where the wrap is more likely to read as the focus having been lost than as a deliberate jump. The type-ahead still wraps, since it looks for the item that matches rather than for the one that comes next. It has no effect in virtualize mode, where the ends of the rendered window are not the ends of the list and the focus stops at them either way. |
| OnClear | EventCallback | The callback that is called when the selection gets cleared, either by the clear button or by the Escape key when ClearOnEscape is enabled. | |
| OnClick | EventCallback<MouseEventArgs> | The click callback for the dropdown. | |
| OnClose | EventCallback | The callback that is called when the callout gets closed. | |
| OnDeselectItem | EventCallback<TItem> | The callback that is called when a selected item gets unselected in multi select mode, by picking it again in the callout, by removing its chip, or through the UnselectItem method. Clearing the whole selection reports itself through OnClear instead. | |
| OnDynamicAdd | EventCallback<TItem> | The callback that is called when a new item is on added Dynamic ComboBox mode. | |
| OnFocusIn | EventCallback<FocusEventArgs> | The callback that is called when the dropdown (or any element inside it, like the ComboBox input) receives the focus. | |
| OnFocusOut | EventCallback<FocusEventArgs> | The callback that is called when the dropdown (or any element inside it, like the ComboBox input) loses the focus. The callout is rendered outside the dropdown so that it can escape any clipping ancestor, so moving the focus into it (with the arrow keys, or by clicking the search box) counts as leaving the dropdown here. | |
| OnOpen | EventCallback | The callback that is called when the callout gets opened. | |
| OnSearch | EventCallback<string?> | The callback that is called when the search text of the search box or combo box input changes, with the term the items are getting filtered by. | |
| OnSelectItem | EventCallback<TItem> | The callback that is called when an item gets picked in the callout. In multi select mode it reports every pick, including the one that unselects an already selected item; use OnDeselectItem to be told only about those. | |
| OnValuesChange | EventCallback<IEnumerable<TValue?>> | The callback that is called when the selected items change. | |
| OpenOnFocus | bool | false | Opens the callout as soon as the dropdown receives the focus, so tabbing into it (or clicking any part of it) already shows the items without a further click or key press. |
| Options | RenderFragment? | null | Alias of ChildContent. |
| OverflowTextFormat | string? | null | The composite format of the overflow indicator that stands for the selected items beyond MaxDisplayedItems in the chips display, for example "+{0}". |
| OverscanCount | int | 3 | Determines how many additional items are rendered before and after the visible region. |
| Placeholder | string? | null | The placeholder text of the dropdown. |
| PlaceholderTemplate | RenderFragment<BitDropdown<TItem, TValue>>? | null | The custom template for the placeholder of the dropdown. |
| Prefix | string? | null | Prefix displayed before the dropdown contents. This is not included in the value. Ensure a descriptive label is present to assist screen readers, as the value does not include the prefix. |
| PrefixTemplate | RenderFragment? | null | Shows the custom prefix for dropdown. |
| PreserveCalloutWidth | bool | false | Disables automatic setting of the callout width and preserves its original width. |
| Reselectable | bool | false | Enables calling the select events when the same item is selected in single select mode. |
| Responsive | bool | false | Enables the responsive mode of the component for small screens. |
| ResponsiveCloseButtonAriaLabel | string? | null | The accessible name (and the tooltip) of the close button in the responsive mode callout. Defaults to the English message. |
| ResponsiveCloseIcon | BitIconInfo? | null | The icon of the close button in the responsive mode callout. Takes precedence over ResponsiveCloseIconName when both are set. |
| ResponsiveCloseIconName | string? | null | The icon name of the close button in the responsive mode callout from the Fluent UI icon set. |
| SearchBoxAriaLabel | string? | null | The accessible name of the SearchBox input. Defaults to the English message. |
| SearchBoxClearButtonAriaLabel | string? | null | The accessible name (and the tooltip) of the clear button of the SearchBox. Defaults to the English message. |
| SearchBoxClearIcon | BitIconInfo? | null | The icon of the clear icon in the SearchBox. Takes precedence over SearchBoxClearIconName when both are set. |
| SearchBoxClearIconName | string? | null | The icon name of the clear icon in the SearchBox from the Fluent UI icon set. |
| SearchBoxIcon | BitIconInfo? | null | The icon of the search icon in the SearchBox. Takes precedence over SearchBoxIconName when both are set. |
| SearchBoxIconName | string? | null | The icon name of the search icon in the SearchBox from the Fluent UI icon set. |
| SearchBoxPlaceholder | string? | null | The placeholder text of the SearchBox input. |
| SearchFunction | Func<ICollection<TItem>, string, ICollection<TItem>>? | null | Custom search function to be used in place of the default search algorithm. Takes precedence over SearchMode, which only configures the default algorithm. |
| SearchIgnoreDiacritics | bool | false | Matches the search text against the item texts with the diacritics of both removed, so that "Jose" finds "José" and "Muller" finds "Müller". The item text itself is left untouched, and so is the part of it that HighlightSearch emphasizes. Ignored when a SearchFunction is provided, which does its own matching. |
| SearchMode | BitDropdownSearchMode | BitDropdownSearchMode.Contains | Determines how the text of an item is matched against the search text by the default (case-insensitive) search algorithm. Ignored when a SearchFunction is provided. |
| SearchResultsText | string? | null | The composite format of the message announced to screen readers with the number of items the current search produced, for example "{0} results available". Defaults to the English message. |
| SelectAllText | string? | null | The text of the select all item in multi select mode. |
| SelectedItemsTextFormat | string? | null | The composite format that replaces the joined item texts in the dropdown once more than MaxDisplayedItems items are selected, for example "{0} items selected". |
| SelectTextOnFocus | bool | false | Selects the text already in the ComboBox input whenever it takes the focus, so that typing replaces the term that is there instead of appending to it - which is what a field the user comes back to in order to search for something else needs. It has no effect outside of the ComboBox mode, and none while the input is empty, where there is nothing to select. |
| ShowClearButton | bool | false | Shows the clear button when an item is selected. |
| ShowSearchBox | bool | false | Shows the SearchBox element in the callout. |
| ShowSelectAll | bool | false | Shows the select all item in the callout in multi select mode. It has no effect when the items are provided by an ItemsProvider, since the items that are not loaded yet cannot be selected. |
| Size | BitSize? | null | The size of the dropdown. |
| StickyHeaders | bool | false | Keeps the header of a group pinned to the top of the item list while its items are scrolled past, so a long grouped list never leaves the user looking at items whose group has scrolled out of view. |
| Styles | BitDropdownClassStyles? | null | Custom CSS styles for different parts of the BitDropdown. |
| Suffix | string? | null | Suffix displayed after the dropdown contents. This is not included in the value. Ensure a descriptive label is present to assist screen readers, as the value does not include the suffix. |
| SuffixTemplate | RenderFragment? | null | Shows the custom suffix for dropdown. |
| TextTemplate | RenderFragment<BitDropdown<TItem, TValue>>? | null | The custom template for the text of the dropdown. |
| ThrottleTime | int | 0 | The throttle time in milliseconds for the search and combo box inputs (applied when Immediate is enabled). |
| Title | string? | null | The title to show when the mouse hovers over the dropdown. |
| TokenSeparators | char[]? | null | The characters that split the text typed (or pasted) into the multi select ComboBox input into separate terms, each committed as its own selection exactly as typing it and pressing Enter would: a term naming an existing item selects it, and with Dynamic enabled a term naming none adds a new item. |
| Transparent | bool | false | Removes the default background color from the root element. |
| Underlined | bool | false | Renders the dropdown with only a bottom border in place of the box around it. |
| ValueComparer | IEqualityComparer<TValue>? | null | Decides whether two values stand for the same selection, in place of the default equality of TValue. It governs every value comparison the component makes: which item a value selects, which selected item a chip removes, and whether a typed term is already selected. |
| Values | IEnumerable<TValue?>? | null | The values of the selected items in multi select mode. (two-way bound) |
| Virtualize | bool | false | Enables virtualization to render only the visible items. |
| VirtualizePlaceholder | RenderFragment<PlaceholderContext>? | null | The template for items that have not yet been rendered in virtualization mode. |
BitDropdown public members
| Name | Type | Default value | Description |
|---|---|---|---|
| SelectedItems | IReadOnlyList<TItem> | A readonly list of the current selected items in multi-select mode. | |
| SelectedItem | TItem? | The current selected item in single-select mode. | |
| SelectItem | Task SelectItem(TItem? item) | Selects the given item exactly as picking it in the callout would, so the same events fire and the same close and focus behavior follows. An item that is already selected is left alone: in multi select mode picking it again would unselect it, which UnselectItem is for. | |
| UnselectItem | Task UnselectItem(TItem? item) | Unselects the given item exactly as picking an already selected one in the callout would (or, in single select mode, as the clear button would), so the same events fire. An item that is not selected is left alone. | |
| RefreshItemsAsync | Task RefreshItemsAsync() | Discards the items loaded so far and asks the ItemsProvider for them again, which is what makes a change outside of the dropdown (a filter of the page, a record added elsewhere) reach a list the dropdown only ever loads on demand. It does nothing without an ItemsProvider, where the Items collection is the source of truth and is re-read on its own. | |
| AssignIsOpen | Task<bool> AssignIsOpen(bool value) | Opens or closes the callout programmatically, without having to bind the IsOpen parameter. It returns false when the change was refused, which is what a one-way bound IsOpen does. | |
| InputElement | ElementReference | The ElementReference to the combobox element of the dropdown, which is the element the user focuses and operates the component with. | |
| FocusAsync | ValueTask FocusAsync(bool preventScroll = false) | Gives focus to the combobox element of the dropdown. | |
| ComboInputElement | ElementReference? | The ElementReference to the combo input element. | |
| FocusComboInputAsync | ValueTask FocusComboInputAsync() | Gives focus to the combo input element. | |
| SearchInputElement | ElementReference? | The ElementReference to the search input element. | |
| FocusSearchInputAsync | ValueTask FocusSearchInputAsync() | Gives focus to the search input element. |
BitInputBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| DefaultValue | TValue? | null | The default value of the input to be used in uncontrolled mode (i.e. when the Value is not bound), typically used alongside the OnChange callback. |
| DisplayName | string? | null | Gets or sets the display name for this field. |
| InputHtmlAttributes | IReadOnlyDictionary<string, object>? | null | Gets or sets a collection of additional attributes that will be applied to the created element. |
| Name | string? | null | Gets or sets the name of the element. Allows access by name from the associated form. |
| NoValidate | bool | false | Disables the validation of the input. |
| OnChange | EventCallback<TValue?> | Callback for when the input value changes. | |
| ReadOnly | bool | false | Makes the input read-only. |
| Required | bool | false | Makes the input required. |
| Value | TValue? | null | Gets or sets the value of the input. This should be used with two-way binding. |
BitInputBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| InputElement | ElementReference | The ElementReference of the input element. | |
| FocusAsync() | () => ValueTask | Gives focus to the input element. | |
| FocusAsync(bool preventScroll) | (bool preventScroll) => ValueTask | Gives focus to the input element. |
BitComponentBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | string? | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | BitDir? | null | Gets or sets the text directionality for the component's content. |
| ForceAnimation | bool | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | Dictionary<string, object> | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| IsEnabled | bool | true | Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| Style | string? | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | string? | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | BitVisibility | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
BitComponentBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| UniqueId | Guid | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | ElementReference | Gets the reference to the root HTML element associated with this component. |
BitDropdownItem<TValue> properties
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | The aria label attribute for the dropdown item. |
| Class | string? | null | Custom CSS class for the dropdown item. |
| Id | string? | null | The id for the dropdown item. |
| Icon | BitIconInfo? | null | The icon to display using custom CSS classes for external icon libraries. Takes precedence over IconName when both are set. |
| IconName | string? | null | The icon name from the Fluent UI icon set. For external icon libraries, use Icon instead. |
| Data | object? | null | The custom data for the dropdown item to provide state for the item template. |
| IsEnabled | bool | true | Determines if the dropdown item is enabled. |
| IsHidden | bool | false | Determines if the dropdown item is hidden. |
| ItemType | BitDropdownItemType | BitDropdownItemType.Normal | The type of the dropdown item. |
| Style | string? | null | Custom CSS style for the dropdown item. |
| Text | string? | null | The text to render for the dropdown item. |
| Title | string? | null | The title attribute for the dropdown item. |
| Value | TValue? | null | The value of the dropdown item. |
| IsSelected | bool | false | Determines if the item is selected. This property's value is assigned by the component. |
BitDropdownOption<TValue> properties
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | The aria label attribute for the dropdown option. |
| Class | string? | null | Custom CSS class for the dropdown option. |
| Id | string? | null | The id for the dropdown option. |
| Data | object? | null | The custom data for the dropdown option to provide extra state for the template. |
| IsEnabled | bool | true | Determines if the dropdown option is enabled. |
| IsHidden | bool | false | Determines if the dropdown option is hidden. |
| Icon | BitIconInfo? | null | The icon to display using custom CSS classes for external icon libraries. Takes precedence over IconName when both are set. |
| IconName | string? | null | The icon name from the Fluent UI icon set. For external icon libraries, use Icon instead. |
| ItemType | BitDropdownItemType | BitDropdownItemType.Normal | The type of the dropdown option. |
| Style | string? | null | Custom CSS style for the dropdown option. |
| Text | string? | null | The text to render for the dropdown option. |
| Title | string? | null | The title attribute for the dropdown option. |
| Value | TValue? | null | The value of the dropdown option. |
| IsSelected | bool | false | Determines if the option is selected. This property's value is assigned by the component. |
BitDropdownNameSelectors<TItem, TValue> properties
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.AriaLabel)) | The AriaLabel field name and selector of the custom input class. |
| Class | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.Class)) | The CSS Class field name and selector of the custom input class. |
| Id | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.Id)) | The Id field name and selector of the custom input class. |
| Data | BitNameSelectorPair<TItem, object?> | new(nameof(BitDropdownItem<TValue>.Data)) | The Data field name and selector of the custom input class. |
| IsEnabled | BitNameSelectorPair<TItem, bool> | new(nameof(BitDropdownItem<TValue>.IsEnabled)) | The IsEnabled field name and selector of the custom input class. |
| IsHidden | BitNameSelectorPair<TItem, bool> | new(nameof(BitDropdownItem<TValue>.IsHidden)) | The IsHidden field name and selector of the custom input class. |
| ItemType | BitNameSelectorPair<TItem, BitDropdownItemType> | new(nameof(BitDropdownItem<TValue>.ItemType)) | The ItemType field name and selector of the custom input class. |
| Icon | BitNameSelectorPair<TItem, BitIconInfo?> | new(nameof(BitDropdownItem<TValue>.Icon)) | The Icon field name and selector of the custom input class. |
| IconName | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.IconName)) | The IconName field name and selector of the custom input class. |
| Style | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.Style)) | The CSS Style field name and selector of the custom input class. |
| Text | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.Text)) | The Text field name and selector of the custom input class. |
| Title | BitNameSelectorPair<TItem, string?> | new(nameof(BitDropdownItem<TValue>.Title)) | The Title field name and selector of the custom input class. |
| Value | BitNameSelectorPair<TItem, TValue?> | new(nameof(BitDropdownItem<TValue>.Value)) | The Value field name and selector of the custom input class. |
| TextSetter | Action<string, TItem>? | The setter function for updating Text property of custom item in Dynamic ComboBox mode upon new item addition. | |
| ValueSetter | Action<TItem, TItem>? | The setter function for updating Value property of custom item in Dynamic ComboBox mode upon new item addition. | |
| IsSelected | string | The IsSelected field name of the custom input class. This property's value is assigned by the component. |
BitNameSelectorPair<TItem, TProp> properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Name | string | Custom class property name. | |
| Selector | Func<TItem, TProp?>? | Custom class property selector. |
BitIconInfo properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Name | string? | null | Gets or sets the name of the icon. |
| BaseClass | string? | null | Gets or sets the base CSS class for the icon. For built-in Fluent UI icons, this defaults to "bit-icon". For external icon libraries like FontAwesome, you might set this to "fa" or leave empty. |
| Prefix | string? | null | Gets or sets the CSS class prefix used before the icon name. For built-in Fluent UI icons, this defaults to "bit-icon--". For external icon libraries, you might set this to "fa-" or leave empty. |
BitDropdownClassStyles properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Root | string? | null | Custom CSS classes/styles for the root element of the BitDropdown. |
| Label | string? | null | Custom CSS classes/styles for the label of the BitDropdown. |
| DescriptionContainer | string? | null | Custom CSS classes/styles for the description container of the BitDropdown. |
| Description | string? | null | Custom CSS classes/styles for the description of the BitDropdown. |
| Container | string? | null | Custom CSS classes/styles for the main container of the BitDropdown. |
| TextContainer | string? | null | Custom CSS classes/styles for the text container of the BitDropdown. |
| ClearButton | string? | null | Custom CSS classes/styles for the clear button of the BitDropdown. |
| CaretDownIcon | string? | null | Custom CSS classes/styles for the caret down icon of the BitDropdown. |
| Overlay | string? | null | Custom CSS classes/styles for the overlay of the BitDropdown. |
| Callout | string? | null | Custom CSS classes/styles for the callout of the BitDropdown. |
| CalloutHeader | string? | null | Custom CSS classes/styles for the container of the callout header template of the BitDropdown. |
| CalloutFooter | string? | null | Custom CSS classes/styles for the container of the callout footer template of the BitDropdown. |
| ResponsiveLabelContainer | string? | null | Custom CSS classes/styles for the responsive panel's label container of the BitDropdown. |
| ResponsiveLabel | string? | null | Custom CSS classes/styles for the responsive panel label of the BitDropdown. |
| ResponsiveCloseButton | string? | null | Custom CSS classes/styles for the responsive panel's close button of the BitDropdown. |
| ResponsiveCloseIcon | string? | null | Custom CSS classes/styles for the responsive panel's close icon of the BitDropdown. |
| SearchBoxContainer | string? | null | Custom CSS classes/styles for the search box container of the BitDropdown. |
| SearchBoxIconContainer | string? | null | Custom CSS classes/styles for the search box's icon container of the BitDropdown. |
| SearchBoxIcon | string? | null | Custom CSS classes/styles for the search box icon of the BitDropdown. |
| SearchBoxInput | string? | null | Custom CSS classes/styles for the search box input of the BitDropdown. |
| ComboBoxInput | string? | null | Custom CSS classes/styles for the ComboBox input of the BitDropdown. |
| Chips | string? | null | Custom CSS classes/styles for the chips container of the BitDropdown. |
| OverflowChip | string? | null | Custom CSS classes/styles for the overflow chip of the BitDropdown. |
| ChipsRemoveButton | string? | null | Custom CSS classes/styles for the chips's remove button of the BitDropdown. |
| ChipsRemoveIcon | string? | null | Custom CSS classes/styles for the chips's remove icon of the BitDropdown. |
| SearchBoxClearButtonContainer | string? | null | Custom CSS classes/styles for the search box's clear button container of the BitDropdown. |
| SearchBoxClearButton | string? | null | Custom CSS classes/styles for the search box's clear button of the BitDropdown. |
| SearchBoxClearIcon | string? | null | Custom CSS classes/styles for the search box's clear icon of the BitDropdown. |
| SearchHint | string? | null | Custom CSS classes/styles for the hint the callout shows while the typed text is still shorter than the MinSearchLength of the BitDropdown. |
| SelectAllContainer | string? | null | Custom CSS classes/styles for the select all item container of the multi-select BitDropdown. |
| SelectAllButton | string? | null | Custom CSS classes/styles for the select all item button of the multi-select BitDropdown. |
| SelectAllCheckBox | string? | null | Custom CSS classes/styles for the select all item check box of the multi-select BitDropdown. |
| SelectAllCheckIcon | string? | null | Custom CSS classes/styles for the select all item check icon of the multi-select BitDropdown. |
| SelectAllText | string? | null | Custom CSS classes/styles for the select all item text of the multi-select BitDropdown. |
| ScrollContainer | string? | null | Custom CSS classes/styles for the scroll container of the BitDropdown. |
| ItemHeader | string? | null | Custom CSS classes/styles for the item header of the BitDropdown. |
| ItemWrapper | string? | null | Custom CSS classes/styles for the item wrapper of the multi-select BitDropdown. |
| ItemButton | string? | null | Custom CSS classes/styles for the item button of the BitDropdown. |
| ItemCheckBox | string? | null | Custom CSS classes/styles for the item check box of the multi-select BitDropdown. |
| ItemCheckIcon | string? | null | Custom CSS classes/styles for the item check icon of the multi-select BitDropdown. |
| ItemIcon | string? | null | Custom CSS classes/styles for the item icon of the BitDropdown. |
| ItemText | string? | null | Custom CSS classes/styles for the item text of the BitDropdown. |
| ItemHighlight | string? | null | Custom CSS classes/styles for the highlighted part of the item text of the BitDropdown. |
| ItemDivider | string? | null | Custom CSS classes/styles for the item divider of the BitDropdown. |
| DynamicItem | string? | null | Custom CSS classes/styles for the row that offers to create a new item out of the typed text in the Dynamic ComboBox mode of the BitDropdown. |
| EmptyContent | string? | null | Custom CSS classes/styles for the empty state content of the BitDropdown. |
| LoadingContainer | string? | null | Custom CSS classes/styles for the loading state container of the BitDropdown. |
| LoadingText | string? | null | Custom CSS classes/styles for the loading state text of the BitDropdown. |
| Spinner | string? | null | Custom CSS classes/styles for the loading spinner of the BitDropdown. |
| PrefixContainer | string? | null | Custom CSS classes/styles for the dropdown's prefix container. |
| Prefix | string? | null | Custom CSS classes/styles for the dropdown's prefix. |
| SuffixContainer | string? | null | Custom CSS classes/styles for the dropdown's suffix container. |
| Suffix | string? | null | Custom CSS classes/styles for the dropdown's suffix. |
| ResponsiveComboInputContainer | string? | null | Custom CSS classes/styles for the ComboBox input container in responsive mode of the BitDropdown. |
| ResponsiveComboAddButton | string? | null | Custom CSS classes/styles for the add new item combo box button in responsive mode of the BitDropdown. |
BitDropdownItemType enum
| Name | Value | Description |
|---|---|---|
| Normal | 0 | Dropdown items are being rendered as a normal item. |
| Header | 1 | Dropdown items are being rendered as a header, they cannot be selected. |
| Divider | 2 | Dropdown items are being rendered as a divider, just draw a line. |
BitDropdownSearchMode enum
| Name | Value | Description |
|---|---|---|
| Contains | 0 | An item matches when its text contains the search text. |
| StartsWith | 1 | An item matches when its text starts with the search text. |
| EndsWith | 2 | An item matches when its text ends with the search text. |
| ExactMatch | 3 | An item matches when its text is equal to the search text. |
BitSize enum
| Name | Value | Description |
|---|---|---|
| Small | 0 | The small size. |
| Medium | 1 | The medium size. |
| Large | 2 | The large size. |
BitColor enum
| Name | Value | Description |
|---|---|---|
| Primary | 0 | Primary general color. |
| Secondary | 1 | Secondary general color. |
| Tertiary | 2 | Tertiary general color. |
| Info | 3 | Info general color. |
| Success | 4 | Success general color. |
| Warning | 5 | Warning general color. |
| SevereWarning | 6 | SevereWarning general color. |
| Error | 7 | Error general color. |
| PrimaryBackground | 8 | Primary background color. |
| SecondaryBackground | 9 | Secondary background color. |
| TertiaryBackground | 10 | Tertiary background color. |
| PrimaryForeground | 11 | Primary foreground color. |
| SecondaryForeground | 12 | Secondary foreground color. |
| TertiaryForeground | 13 | Tertiary foreground color. |
| PrimaryBorder | 14 | Primary border color. |
| SecondaryBorder | 15 | Secondary border color. |
| TertiaryBorder | 16 | Tertiary border color. |
BitVisibility enum
| Name | Value | Description |
|---|---|---|
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
BitDir enum
| Name | Value | Description |
|---|---|---|
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.