Skip to content
# MenuButton **Also known as:** DropdownButton, SplitButton, Menu ## Description A menu button combines a button with a callout menu of related actions or links. It supports split and sticky modes, toggle behavior, nested submenus, check and single-choice items, group headers, separators, links, keyboard shortcuts, a loading state, and full keyboard navigation with proper ARIA menu semantics. ## Parameters | Name | Type | Default Value | Description | | :--- | :--- | :------------ | :---------- | | AriaDescription | `string?` | null | Detailed description of the menu button for the benefit of screen readers. | | AriaHidden | `bool` | false | If true, add an aria-hidden attribute instructing screen readers to ignore the menu button. | | AutoFocus | `bool` | false | If true, the header button automatically receives focus when the page renders. It is dropped on a menu button hidden from assistive technologies, and on a disabled one that is not kept focusable. | | AutoLoading | `bool` | false | Enters the loading state automatically while awaiting OnClick and ignores further clicks of the header button until it returns. Meant for the main half of a split menu button, whose chevron keeps opening the menu while the command runs. | | Background | `BitColorKind?` | null | The background color kind of the callout. | | ButtonType | `BitButtonType?` | null | The value of the type attribute of the menu button. | | CheckIcon | `BitIconInfo?` | null | The icon of the check mark shown on a checked item, from an external icon library. Takes precedence over CheckIconName. | | CheckIconName | `string?` | null | The name of the icon of the check mark shown on a checked item. Defaults to the Accept icon. | | ChevronDownAriaLabel | `string?` | "More options" | The aria-label of the chevron down button of the split menu button. The chevron carries no text of its own, so without a name it reaches a screen reader as an unlabelled button. | | ChevronDownIcon | `BitIconInfo?` | null | The icon for the chevron down part of the menu button. | | ChevronDownIconName | `string?` | null | The icon name of the chevron down part of the menu button. | | ChevronDownTitle | `string?` | null | The tooltip to show when the mouse is placed on the chevron down button of the split menu button. | | ChildContent | `RenderFragment?` | null | The content of the menu button, that are BitMenuButtonOption components. | | Classes | `BitMenuButtonClassStyles?` | null | Custom CSS classes for different parts of the menu button. | | CloseOnItemClick | `bool` | true | Closes the callout when an item is clicked. Turn it off for a menu of checkable items, so several can be toggled without reopening it. | | Color | `BitColor?` | null | The general color of the menu button. | | DefaultSelectedItem | `TItem?` | null | Default value of the SelectedItem. | | DefaultIsToggled | `bool?` | null | Default value of the IsToggled parameter in toggle mode. | | DisabledInteractive | `bool` | false | Keeps a disabled menu button, and the disabled items of any menu button, focusable: the state is conveyed with the aria-disabled attribute instead of the native disabled one, so they stay reachable and are announced as unavailable rather than silently skipped. Their actions stay suppressed either way. | | DropDirection | `BitDropDirection` | BitDropDirection.TopAndBottom | Determines the allowed drop directions of the callout. | | FormId | `string?` | null | The id of the form element the menu button is associated with, rendered as the form attribute of the header button and of the items. It lets a submit or reset command sit outside of its form. | | FullWidth | `bool` | false | Expands the menu button width to 100% of the available width. | | HeaderTemplate | `RenderFragment?` | null | The content inside the header of menu button can be customized. | | 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 from built-in Fluent UI icons to show inside the header of menu button. | | IconOnly | `bool` | false | Renders the header button as its icon alone: the text and the chevron beside it are dropped and the button becomes a square of the control's own height - the overflow trigger of a toolbar or a row. It then has no text to be named by, so give it an AriaLabel. In split mode only the main half is squared up, since the chevron half is the only way into the menu. | | IsLoading | `bool` | false | Determines whether the menu button is in the loading state. It replaces the default icon of the header button with a spinner and ignores its click; in split mode the chevron still opens the menu. | | IsOpen | `bool` | false | Determines the opening state of the callout. | | IsToggled | `bool` | false | Determines whether the header button is in the toggled state when Toggle is enabled. | | Items | `IEnumerable<TItem>` | new List<TItem>() | List of items to show in the menu button. | | ItemTemplate | `RenderFragment<TItem?>?` | null | The custom template content to render each item. | | LoadingDelay | `int` | 0 | The delay in milliseconds before the spinner appears after the menu button enters the loading state, which keeps a fast operation from flashing one. The click guard applies immediately regardless. | | LoadingLabel | `string?` | null | The text to show beside the spinner in the loading state, replacing the text of the header button. It is also announced by screen readers through a status live region. | | LoadingTemplate | `RenderFragment?` | null | The custom template that replaces the spinner and the label of the header button while the menu button is in the loading state. | | MaxHeight | `string?` | null | The tallest the callout grows before its items start to scroll, as a CSS length. Without one the callout is capped to the room the viewport leaves. | | NameSelectors | `BitMenuButtonNameSelectors<TItem>?` | null | Names and selectors of the custom input type properties. | | NoIcon | `bool` | false | If true, the icon of the header button is hidden. | | OnClick | `EventCallback<TItem?>` | | The callback that is called when the header button is clicked, with the selected item in Sticky mode and null otherwise, and when an item of the menu is activated outside of Sticky mode, with that item. | | OnChange | `EventCallback<TItem>` | | The callback that is called when the selected item has changed. | | OnToggleChange | `EventCallback<bool>` | | The callback that is called when the IsToggled value changes in toggle mode. | | Options | `RenderFragment?` | null | Alias of the ChildContent. | | RadioIcon | `BitIconInfo?` | null | The icon of the bullet shown on a checked single-choice item, using custom CSS classes for external icon libraries. Takes precedence over RadioIconName when both are set. | | RadioIconName | `string?` | null | The name of the icon of the bullet shown on a checked single-choice item (one whose RadioGroup is set). | | Reclickable | `bool` | false | Enables re-clicking the header button while the menu button is in the loading state. By default its click is ignored, which is what protects against a double submission. | | SelectedItem | `TItem?` | null | Determines the current selected item that acts as the header item. | | Size | `BitSize?` | null | The size of the menu button. | | Split | `bool` | false | If true, the menu button renders as a split button. | | Sticky | `bool` | false | If true, the selected item is going to change the header item. | | StopPropagation | `bool` | false | If true, stops the propagation of the click event of the menu button to the parent elements. Useful when the menu button is placed inside clickable containers like rows or cards. | | Styles | `BitMenuButtonClassStyles?` | null | Custom CSS styles for different parts of the menu button. | | SubmenuIcon | `BitIconInfo?` | null | The icon of the chevron an item that opens a submenu carries, using custom CSS classes for external icon libraries. Takes precedence over SubmenuIconName when both are set. | | SubmenuIconName | `string?` | null | The name of the icon of the chevron an item that opens a submenu carries. It is mirrored in a right-to-left menu, so one icon serves both directions. | | Text | `string?` | null | The text to show inside the header of menu button. | | Title | `string?` | null | The tooltip to show when the mouse is placed on the header button. | | Toggle | `bool` | false | If true, enables toggle behavior on the header button in Split mode. | | Variant | `BitVariant?` | null | The visual variant of the menu button. | | 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. | ## 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. | ## Enums ### BitColorKind Enum | Name | Value | Description | | :--- | :--- | :---------- | | Primary | 0 | The primary color kind. | | Secondary | 1 | The secondary color kind. | | Tertiary | 2 | The tertiary color kind. | | Transparent | 3 | The transparent color kind. | ### 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). | ### BitColor Enum | Name | Value | Description | | :--- | :--- | :---------- | | Primary | 0 | Info 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. | ### BitDropDirection Enum | Name | Value | Description | | :--- | :--- | :---------- | | All | 0 | The callout is positioned in all directions. | | TopAndBottom | 1 | The callout is positioned in the top and bottom directions. | ### BitSize Enum | Name | Value | Description | | :--- | :--- | :---------- | | Small | 0 | The small size. | | Medium | 1 | The medium size. | | Large | 2 | The large size. | ### BitVariant Enum | Name | Value | Description | | :--- | :--- | :---------- | | Fill | 0 | Fill styled variant. | | Outline | 1 | Outline styled variant. | | Text | 2 | Text styled variant. | ### 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. | ## Sub Classes ### BitMenuButtonItem Properties | Name | Type | Default Value | Description | | :--- | :--- | :------------ | :---------- | | AriaLabel | `string?` | null | The accessible name of the item, for the benefit of screen readers. Set it on an item whose visible label is an icon alone. | | Checkable | `bool` | false | Turns the item into a check item: it is announced as a checkbox inside the menu, carries its IsChecked state as a check mark, and flips that state when it is clicked. | | ChildItems | `List<BitMenuButtonItem>` | [] | The items of the submenu that opens from this item. An item that has children opens its submenu instead of raising a click: it is announced with aria-haspopup, it carries a trailing chevron, and the arrow keys walk into and out of it. | | Class | `string?` | null | The custom CSS classes of the item. | | Href | `string?` | null | The value of the href attribute of the item. If provided, the item renders as an anchor tag instead of button. | | Icon | `BitIconInfo?` | null | The icon to render next to the item text. Takes precedence over IconName. | | IconName | `string?` | null | Name of an icon to render next to the item text. | | IsChecked | `bool` | false | The checked state of a Checkable item. The menu button writes it back as the item is clicked. | | IsEnabled | `bool` | true | Whether or not the item is enabled. | | IsHeader | `bool` | false | If true, the item renders as the label of the group of items that follow it. It is presentational: the keyboard navigation steps over it. | | IsSelected | `bool` | false | Determines the selection state of the item. | | IsSeparator | `bool` | false | If true, the item renders as a separator line instead of a clickable item. | | Key | `string?` | null | A unique value to use as a Key of the item. | | OnClick | `Action<BitMenuButtonItem>?` | null | Click event handler of the item. | | RadioGroup | `string?` | null | Turns the item into a single-choice item: it is announced as a radio button inside the menu, carries its IsChecked state as a bullet, and checking it clears every other item of the menu button that names the same group. It outranks Checkable where both are set. | | SecondaryText | `string?` | null | The trailing text of the item, shown at its far end and read after its label - a keyboard shortcut, a count, a short hint. | | Style | `string?` | null | The custom value for the style attribute of the item. | | Target | `string?` | null | The value of the target attribute of the item when the item renders as an anchor tag (by providing the Href value). | | Template | `RenderFragment<BitMenuButtonItem>?` | null | The custom template for the item. | | Text | `string?` | null | Text to render in the item. | | Title | `string?` | null | The tooltip to show when the mouse is placed on the item. | ### BitMenuButtonOption Properties | Name | Type | Default Value | Description | | :--- | :--- | :------------ | :---------- | | AriaLabel | `string?` | null | The accessible name of the option, for the benefit of screen readers. Set it on an option whose visible label is an icon alone. | | Checkable | `bool` | false | Turns the option into a check item: it is announced as a checkbox inside the menu, carries its IsChecked state as a check mark, and flips that state when it is clicked. | | ChildContent | `RenderFragment?` | null | The nested BitMenuButtonOption components of the submenu that opens from this option. An option that has children opens its submenu instead of raising a click: it is announced with aria-haspopup, it carries a trailing chevron, and the arrow keys walk into and out of it. | | Class | `string?` | null | The custom CSS classes of the option. | | Href | `string?` | null | The value of the href attribute of the option. If provided, the option renders as an anchor tag instead of button. | | Icon | `BitIconInfo?` | null | The icon to render next to the option text. Takes precedence over IconName. | | IconName | `string?` | null | Name of an icon to render next to the option text. | | IsChecked | `bool` | false | The checked state of a Checkable option, which supports two-way binding (@bind-IsChecked). | | IsCheckedChanged | `EventCallback<bool>` | | The callback that is called when the IsChecked value changes, which is what makes @bind-IsChecked work. | | IsEnabled | `bool` | true | Whether or not the option is enabled. | | IsHeader | `bool` | false | If true, the option renders as the label of the group of options that follow it. It is presentational: the keyboard navigation steps over it. | | IsSelected | `bool` | false | Determines the selection state of the item. | | IsSeparator | `bool` | false | If true, the option renders as a separator line instead of a clickable item. | | Key | `string?` | null | A unique value to use as a key of the option. | | OnClick | `EventCallback<BitMenuButtonOption>` | | Click event handler of the option. | | RadioGroup | `string?` | null | Turns the option into a single-choice option: it is announced as a radio button inside the menu, carries its IsChecked state as a bullet, and checking it clears every other option of the menu button that names the same group. It outranks Checkable where both are set. | | SecondaryText | `string?` | null | The trailing text of the option, shown at its far end and read after its label - a keyboard shortcut, a count, a short hint. | | Style | `string?` | null | The custom value for the style attribute of the option. | | Target | `string?` | null | The value of the target attribute of the option when the option renders as an anchor tag (by providing the Href value). | | Template | `RenderFragment<BitMenuButtonOption>?` | null | The custom template for the option. | | Text | `string?` | null | Text to render in the option. | | Title | `string?` | null | The tooltip to show when the mouse is placed on the option. | ### BitMenuButtonClassStyles Properties | Name | Type | Default Value | Description | | :--- | :--- | :------------ | :---------- | | Root | `string?` | null | Custom CSS classes/styles for the root element of the BitMenuButton. | | Opened | `string?` | null | Custom CSS classes/styles for the opened callout state 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 of the BitMenuButton. | | CalloutContainer | `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. | | Submenu | `string?` | null | Custom CSS classes/styles for the submenu callout of each item of the BitMenuButton that opens one. | | Icon | `string?` | null | Custom CSS classes/styles for the icon of the BitMenuButton. | | ItemWrapper | `string?` | null | Custom CSS classes/styles for each item wrapper 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. | | ItemCheckIcon | `string?` | null | Custom CSS classes/styles for the mark of each check or single-choice item of the BitMenuButton. | | ItemChevron | `string?` | null | Custom CSS classes/styles for the chevron of each item of the BitMenuButton that opens a submenu. | | ItemHeader | `string?` | null | Custom CSS classes/styles for each group header item of the BitMenuButton. | | ItemSecondaryText | `string?` | null | Custom CSS classes/styles for the secondary text of each item of the BitMenuButton. | | ItemSeparator | `string?` | null | Custom CSS classes/styles for each item separator 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. | | Spinner | `string?` | null | Custom CSS classes/styles for the spinner of the BitMenuButton in the loading state. | | Text | `string?` | null | Custom CSS classes/styles for the text of the BitMenuButton. | | Toggled | `string?` | null | Custom CSS classes/styles for the toggled state of the BitMenuButton. | ### BitMenuButtonNameSelectors Properties | Name | Type | Default Value | Description | | :--- | :--- | :------------ | :---------- | | AriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.AriaLabel)) | AriaLabel field name and selector of the custom input class. | | Checkable | `BitNameSelectorPair<TItem, bool>` | new(nameof(BitMenuButtonItem.Checkable)) | Checkable field name and selector of the custom input class. | | ChildItems | `BitNameSelectorPair<TItem, List<TItem>?>` | new(nameof(BitMenuButtonItem.ChildItems)) | ChildItems field name and selector of the custom input class. | | Class | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.Class)) | The CSS Class field name and selector of the custom input class. | | Href | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.Href)) | Href field name and selector of the custom input class. | | Icon | `BitNameSelectorPair<TItem, BitIconInfo?>` | new(nameof(BitMenuButtonItem.Icon)) | Icon 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. | | IsChecked | `BitNameSelectorPair<TItem, bool>` | new(nameof(BitMenuButtonItem.IsChecked)) | IsChecked field name and selector of the custom input class. The menu button writes the new state back to the named property as a check item is clicked, so a selector alone leaves the toggling to the page. | | IsEnabled | `BitNameSelectorPair<TItem, bool>` | new(nameof(BitMenuButtonItem.IsEnabled)) | IsEnabled field name and selector of the custom input class. | | IsHeader | `BitNameSelectorPair<TItem, bool>` | new(nameof(BitMenuButtonItem.IsHeader)) | IsHeader 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. | | IsSeparator | `BitNameSelectorPair<TItem, bool>` | new(nameof(BitMenuButtonItem.IsSeparator)) | IsSeparator 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. | | RadioGroup | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.RadioGroup)) | RadioGroup field name and selector of the custom input class. | | SecondaryText | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.SecondaryText)) | SecondaryText 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. | | Target | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.Target)) | Target field name and selector of the custom input class. | | Template | `BitNameSelectorPair<TItem, RenderFragment<TItem>?>` | new(nameof(BitMenuButtonItem.Template)) | Template 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. | | Title | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitMenuButtonItem.Title)) | Title 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. | ### 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. | ## CSS Variables Public CSS custom properties read off the component's root. Set one on `:root` to restyle every instance, on any ancestor to restyle the ones inside it, or on the `Style` of one instance. | Name | Default Value | Description | | :--- | :------------ | :---------- | | `--bit-MenuButton-color` | The Color role's on-color (Fill) or main color (Outline, Text) | Text and icon color of both halves of the button at rest. | | `--bit-MenuButton-background` | The Color role's main color (Fill), transparent (Outline, Text) | Background of the button at rest. | | `--bit-MenuButton-border-color` | The background, or transparent for the Text variant | Border color of the button. | | `--bit-MenuButton-border-width` | --bit-shp-brd-width | Border thickness of the button. | | `--bit-MenuButton-radius` | --bit-shp-radius-button | Corner radius of the button, followed by its focus ring. | | `--bit-MenuButton-hover-color` | The Color role's on-color | Text and icon color of the hovered half (pointer devices only). | | `--bit-MenuButton-hover-background` | The Color role's hover color | Background of the hovered half (pointer devices only). | | `--bit-MenuButton-active-color` | The Color role's on-color | Text and icon color of the pressed half, and of the chevron while the menu is open. | | `--bit-MenuButton-active-background` | The Color role's active color | Background of the pressed half, and of the chevron while the menu is open. | | `--bit-MenuButton-toggled-color` | The Color role's on-color | Text and icon color of the header button while it is toggled. | | `--bit-MenuButton-toggled-background` | The Color role's dark color | Background of the header button while it is toggled. | | `--bit-MenuButton-toggled-hover-background` | The Color role's dark-hover color | Background of the toggled header button on hover (pointer devices only). | | `--bit-MenuButton-toggled-active-background` | The Color role's dark-active color | Background of the toggled header button while it is pressed. | | `--bit-MenuButton-disabled-color` | The Color role's disabled text color | Text and icon color when the menu button is disabled. | | `--bit-MenuButton-disabled-background` | The Color role's disabled color (Fill), transparent (Outline, Text) | Background when the menu button is disabled. | | `--bit-MenuButton-disabled-border-color` | The disabled background | Border color when the menu button is disabled. | | `--bit-MenuButton-focus-color` | The Color role's focus color | Focus ring color of the button. | | `--bit-MenuButton-min-height` | --bit-siz-ctrl-sm/md/lg per Size | Smallest height of the button, the width of the chevron half unless that is set on its own, and the width of an IconOnly header. It is a floor, so the button still grows with a taller icon or a wrapped label. | | `--bit-MenuButton-padding` | Per Size, from the control padding tokens | Padding of each half of the button. The chevron half drops the side padding, since it is a square. | | `--bit-MenuButton-gap` | 0.5rem | Room between the icon, the text and the chevron. | | `--bit-MenuButton-font-size` | --bit-tpg-fs-xs/sm/md per Size | Text size of the button and of the items, which inherit it from the callout. | | `--bit-MenuButton-icon-size` | --bit-siz-icon-sm/md/lg per Size | Size of every glyph the component draws: the header icon, the chevron, the spinner, an item icon and a check mark. | | `--bit-MenuButton-chevron-width` | The min-height of the button | Width of the chevron half of a split button. | | `--bit-MenuButton-divider-color` | The text color (Fill) or the border color (Outline, Text) | The hairline between the two halves of a split button. | | `--bit-MenuButton-callout-background` | --bit-clr-bg-pri, or the surface of the Background kind | Background of the callout, and of every submenu opened from inside it. | | `--bit-MenuButton-callout-radius` | --bit-shp-radius-popup | Corner radius of the callout, applied to the corners away from the button. | | `--bit-MenuButton-callout-shadow` | --bit-shd-popup | Elevation of the callout. | | `--bit-MenuButton-callout-max-height` | The room the viewport leaves | The tallest the callout grows before its items scroll. Only read when the MaxHeight parameter is set, which is what the parameter writes it as. | | `--bit-MenuButton-callout-min-width` | The width of the button | Narrowest the callout gets. The positioning code already stretches the callout to the width of the button, so this is a floor beyond that. | | `--bit-MenuButton-callout-max-width` | The width of the viewport | The widest the callout gets before the labels of its items are ellipsized. Without a cap, one long label would widen the callout past the side of the screen. | | `--bit-MenuButton-callout-padding` | 0 | Padding around the list of items inside the callout. Flush by default, so a menu is the list of its rows and nothing else. | | `--bit-MenuButton-item-color` | --bit-clr-fg-pri | Text and icon color of an item. | | `--bit-MenuButton-item-min-height` | --bit-siz-item-sm/md/lg per Size | Smallest height of an item. | | `--bit-MenuButton-item-padding` | Per Size, from the control padding tokens | Padding of an item, and of a group header. | | `--bit-MenuButton-item-gap` | 0.5rem | Room between the check column, the icon, the label and the secondary text of an item. | | `--bit-MenuButton-item-hover-background` | --bit-clr-bg-pri-hover | Background of a hovered item, and of the row whose submenu is open. The items are neutral surfaces, so the label keeps its own color. | | `--bit-MenuButton-item-active-background` | --bit-clr-bg-pri-active | Background of a pressed item. | | `--bit-MenuButton-item-checked-background` | --bit-clr-bg-sec | Background of a checked item, kept while the pointer is elsewhere. | | `--bit-MenuButton-item-checked-color` | The Color role's main color | The mark of a checked item: the check mark of a check item, the bullet of a single-choice one. | | `--bit-MenuButton-item-disabled-color` | --bit-clr-fg-dis | Text and icon color of a disabled item. | | `--bit-MenuButton-item-focus-color` | The Color role's focus color | Focus ring of the item the keyboard navigation is on. It is drawn inside the item, since the callout clips what overflows it. | | `--bit-MenuButton-item-separator-color` | --bit-clr-brd-sec | The hairline of a separator item. | | `--bit-MenuButton-item-secondary-color` | --bit-clr-fg-sec | The secondary text of an item - a keyboard shortcut, a count. | | `--bit-MenuButton-item-header-color` | --bit-clr-fg-sec | The label of a group header item. | ## Examples
\n**Basic**: ```razor ``` ```csharp private List basicItems = [ new() { Text = "Item A", Key = "A" }, new() { Text = "Item B", Key = "B", IsEnabled = false }, new() { Text = "Item C", Key = "C" } ]; ``` \n**Templates**: ```razor
Custom Header!
@item.Text (@item.Key)
``` ```csharp private List basicItems = [ new() { Text = "Item A", Key = "A" }, new() { Text = "Item B", Key = "B", IsEnabled = false }, new() { Text = "Item C", Key = "C" } ]; private List itemTemplateItems = [ new() { Text = "Add", Key = "add-key", IconName = BitIconName.Add }, new() { Text = "Edit", Key = "edit-key", IconName = BitIconName.Edit }, new() { Text = "Delete", Key = "delete-key", IconName = BitIconName.Delete } ]; private List itemTemplateItems2 = [ new() { Text = "Add", Key = "add-key", IconName = BitIconName.Add, Template = (item => @
@item.Text (@item.Key)
) }, new () { Text = "Edit", Key = "edit-key", IconName = BitIconName.Edit, Template = (item => @
@item.Text (@item.Key)
) }, new() { Text = "Delete", Key = "delete-key", IconName = BitIconName.Delete, Template = (item => @
@item.Text (@item.Key)
) } ]; ``` \n**External Icons**: ```razor ``` ```csharp private static List externalIconItems = [ new() { Text = "Add", Icon = "fa-solid fa-plus" }, new() { Text = "Edit", Icon = BitIconInfo.Css("fa-solid fa-pen") }, new() { Text = "Delete", Icon = BitIconInfo.Fa("solid trash") } ]; ``` \n**Style & Class**: ```razor ``` ```csharp private List basicItems = new() { new() { Text = "Item A", Key = "A" }, new() { Text = "Item B", Key = "B", IsEnabled = false }, new() { Text = "Item C", Key = "C" } }; private static List itemStyleClassItems = [ new() { Text = "Item A (Default)", Key = "A", IconName = BitIconName.Emoji, Style = "color: brown" }, new() { Text = "Item C (Styled)", Key = "B", IconName = BitIconName.Emoji, Style = "color: tomato; border-color: brown; background-color: peachpuff;" }, new() { Text = "Item B (Classed)", Key = "C", IconName = BitIconName.Emoji2, Class = "custom-item" } ]; private static List destructiveItems = [ new() { Text = "Edit", Key = "edit", IconName = BitIconName.Edit }, new() { Text = "Duplicate", Key = "duplicate", IconName = BitIconName.Copy }, new() { IsSeparator = true }, new() { Text = "Delete", Key = "delete", IconName = BitIconName.Delete, Style = "--bit-MenuButton-item-color: var(--bit-clr-err);" } ]; ```