- bit BlazorUI

MenuButton

A menu button is a menu item that displays a word or phrase that the user can click to initiate an operation.

Notes

The BitMenuButton is a Multi-API component which can accept the list of Items in 3 different ways: BitMenuButtonItem class, a custom Generic class, and BitMenuButtonOption component.

Usage

Implementation

BitMenuButton parameters
Name
Type
Default value
Description
AriaDescription string? null Detailed description of the button for the benefit of screen readers.
AriaHidden bool false If true, add an aria-hidden attribute instructing screen readers to ignore the element.
ButtonStyle BitButtonStyle BitButtonStyle.Primary The style of button, Possible values: Primary | Standard.
ButtonType BitButtonType null The type of the button.
ChevronDownIcon string ChevronDown Icon name of the chevron down part of the BitMenuButton.
ChildContent RenderFragment? null The content of the BitMenuButton, that are BitMenuButtonOption components.
Classes BitMenuButtonClassStyles? null Custom CSS classes for different parts of the BitMenuButton.
DefaultSelectedItem TItem? null Default value of the SelectedItem.
HeaderTemplate RenderFragment? null The content inside the header of BitMenuButton can be customized.
IconName string? null The icon name to show inside the header of BitMenuButton.
Items IEnumerable<TItem> new List<TItem>() List of Item, each of which can be a Button with different action in the BitMenuButton.
ItemTemplate RenderFragment<TItem>? null The custom content to render each item.
NameSelectors BitMenuButtonNameSelectors<TItem>? null Names and selectors of the custom input type properties.
OnClick EventCallback<MouseEventArgs> The callback is called when the BitMenuButton header is clicked.
OnItemClick EventCallback<TItem> OnClick of each item returns that item with its property.
Options RenderFragment? null Alias of ChildContent.
SelectedItem TItem? null Determines the current selected item that acts as the main button.
Split bool false If true, the button will render as a SplitButton.
Sticky bool false If true, the current item is going to be change selected item.
Styles BitMenuButtonClassStyles? null Custom CSS styles for different parts of the BitMenuButton.
Text string? null The text to show inside the header of BitMenuButton.
BitComponentBase parameters
Name
Type
Default value
Description
AriaLabel string? null The aria-label of the control for the benefit of screen readers.
Class string? null Custom CSS class for the root element of the component.
Dir BitDir? null Determines the component direction.
HtmlAttributes Dictionary<string, object> new Dictionary<string, object>() Capture and render additional attributes in addition to the component's parameters.
Id string? null Custom id attribute for the root element. if null the UniqueId will be used instead.
IsEnabled bool true Whether or not the component is enabled.
Style string? null Custom CSS style for the root element of the component.
Visibility BitVisibility BitVisibility.Visible Whether the component is visible, hidden or collapsed.
BitComponentBase public members
Name
Type
Default value
Description
UniqueId Guid Guid.NewGuid() The readonly unique id of the root element. it will be assigned to a new Guid at component instance construction.
RootElement ElementReference The ElementReference of the root element.
BitMenuButtonClassStyles properties
Name
Type
Default value
Description
Root string? null Custom CSS classes/styles for the root element of the BitMenuButton.
OperatorButton string? null Custom CSS classes/styles for operator button of the BitMenuButton.
OperatorButtonIcon string? null Custom CSS classes/styles for operator button icon of the BitMenuButton.
OperatorButtonText string? null Custom CSS classes/styles for operator button text of the BitMenuButton.
Callout string? null Custom CSS classes/styles for the callout container of the BitMenuButton.
ChevronDownButton string? null Custom CSS classes/styles for the chevron down button of the BitMenuButton.
ChevronDown string? null Custom CSS classes/styles for the chevron down of the BitMenuButton.
Separator string? null Custom CSS classes/styles for the separator of the BitMenuButton.
Icon string? null Custom CSS classes/styles for the icon of the BitMenuButton.
ItemButton string? null Custom CSS classes/styles for each item of the BitMenuButton.
ItemIcon string? null Custom CSS classes/styles for each item icon of the BitMenuButton.
ItemText string? null Custom CSS classes/styles for each item text of the BitMenuButton.
Overlay string? null Custom CSS classes/styles for each overlay of the BitMenuButton.
Text string? null Custom CSS classes/styles for the text of the BitMenuButton.
BitMenuButtonNameSelectors properties
Name
Type
Default value
Description
Class BitNameSelectorPair<TItem, string?> new(nameof(BitMenuButtonItem.Class)) The CSS Class field name and selector of the custom input class.
IconName BitNameSelectorPair<TItem, string?> new(nameof(BitMenuButtonItem.IconName)) IconName field name and selector of the custom input class.
IsEnabled BitNameSelectorPair<TItem, bool> new(nameof(BitMenuButtonItem.IsEnabled)) IsEnabled field name and selector of the custom input class.
IsSelected BitNameSelectorPair<TItem, bool> new(nameof(BitMenuButtonItem.IsSelected)) IsSelected field name and selector of the custom input class.
Key BitNameSelectorPair<TItem, string?> new(nameof(BitMenuButtonItem.Key)) Key field name and selector of the custom input class.
OnClick BitNameSelectorPair<TItem, Action<TItem>?> new(nameof(BitMenuButtonItem.OnClick)) OnClick field name and selector of the custom input class.
Style BitNameSelectorPair<TItem, string?> new(nameof(BitMenuButtonItem.Style)) Style field name and selector of the custom input class.
Text BitNameSelectorPair<TItem, string?> new(nameof(BitMenuButtonItem.Text)) Text field name and selector of the custom input class.
BitNameSelectorPair properties
Name
Type
Default value
Description
Name string Custom class property name.
Selector Func<TItem, TProp?>? Custom class property selector.
BitButtonStyle enum
Name
Value
Description
Primary 0 The button with white text on a blue background.
Standard 1 The button with black text on a white background.
Text 2 The button for less-pronounced actions.
BitButtonType enum
Name
Value
Description
Button 0 The button is a clickable button.
Submit 1 The button is a submit button (submits form-data).
Reset 2 The button is a reset button (resets the form-data to its initial values).
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.