Buttons
MenuButton
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.
Notes
1. The BitMenuButtonItem class
2. A Custom Generic class
3. The BitMenuButtonOption component
The component follows the WAI-ARIA menu button pattern. The button is the only thing in the tab order; from it, Enter, Space and the arrow keys open the menu and move the focus into it. Inside, ↑ / ↓ and Home / End move between the items (wrapping around, and stepping over the separators and the group headers), typing jumps to the item that starts with what was typed - the keystrokes that arrive within a second of each other are one search string, and the same character pressed again cycles through the items under it - Enter or Space activates the focused item, and Esc or Tab closes the menu, returning the focus to the button.
Usage
Every example is live. Open its code to see exactly what produced the component running underneath.
Basic
Split
Variant
Sticky
Icons
Callout
Toggle
Checkable
Templates
Events
Binding
Grouping
Links
FullWidth
Loading
Accessibility
DropDirection
Submenu
Cascading parameters
Color
External Icons
Size
Style & Class
RTL
CSS variables
The public custom properties this component reads off its root, for what no parameter covers.
Every variable is read with a fallback and never declared by the component, so it inherits like any other custom property:
set one on :root (or in a [bit-theme] block) to restyle every instance, on any ancestor to restyle the ones inside it,
or on the Style of one instance to restyle it - and any instance nested inside it, which inherits the value too; a parameter changes one alone,
as does the real CSS property on the instance's Style / Styles when that property does not inherit (opacity: 1 keeps
one disabled instance undimmed without undimming a disabled one inside it), while an inherited one such as color or
font-family also reaches the nested instances that do not set it themselves. Leave a variable unset and the component
falls back to the theme token beside it.
BitMenuButton CSS variables
| Name | Default value | Description |
|---|---|---|
| --bit-MenuButton-color | --bit-clr-pri-text (Fill) or --bit-clr-pri (Outline, Text) | Text and icon color of both halves of the button at rest. The Color parameter wins over it. Shared by the three variants: --bit-MenuButton-fill-color, --bit-MenuButton-outline-color and --bit-MenuButton-text-color are read ahead of it. |
| --bit-MenuButton-background | --bit-clr-pri (Fill), transparent (Outline, Text) | Background of the button at rest. The Color parameter wins over it in Fill; the transparent background of Outline and Text is its alone. Shared by the three variants: --bit-MenuButton-fill-background, --bit-MenuButton-outline-background and --bit-MenuButton-text-background are read ahead of it. |
| --bit-MenuButton-border-color | The background, or transparent for the Text variant | Border color of the button. The Color parameter wins over it, except over the transparent border of Text. Shared by the three variants: --bit-MenuButton-fill-border-color, --bit-MenuButton-outline-border-color and --bit-MenuButton-text-border-color are read ahead of it. |
| --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 | --bit-clr-pri-text | Text and icon color of the hovered half (pointer devices only). The Color parameter wins over it. Shared by the three variants: --bit-MenuButton-fill-hover-color, --bit-MenuButton-outline-hover-color and --bit-MenuButton-text-hover-color are read ahead of it. |
| --bit-MenuButton-hover-background | --bit-clr-pri-hover | Background of the hovered half (pointer devices only). The Color parameter wins over it. Shared by the three variants: --bit-MenuButton-fill-hover-background, --bit-MenuButton-outline-hover-background and --bit-MenuButton-text-hover-background are read ahead of it. |
| --bit-MenuButton-active-color | --bit-clr-pri-text | Text and icon color of the pressed half, and of the chevron while the menu is open. The Color parameter wins over it. Shared by the three variants: --bit-MenuButton-fill-active-color, --bit-MenuButton-outline-active-color and --bit-MenuButton-text-active-color are read ahead of it. |
| --bit-MenuButton-active-background | --bit-clr-pri-active | Background of the pressed half, and of the chevron while the menu is open. The Color parameter wins over it. Shared by the three variants: --bit-MenuButton-fill-active-background, --bit-MenuButton-outline-active-background and --bit-MenuButton-text-active-background are read ahead of it. |
| --bit-MenuButton-toggled-color | --bit-clr-pri-text | Text and icon color of the header button while it is toggled. The Color parameter wins over it. |
| --bit-MenuButton-toggled-background | --bit-clr-pri-dark | Background of the header button while it is toggled. The Color parameter wins over it. |
| --bit-MenuButton-toggled-hover-background | --bit-clr-pri-dark-hover | Background of the toggled header button on hover (pointer devices only). The Color parameter wins over it. |
| --bit-MenuButton-toggled-active-background | --bit-clr-pri-dark-active | Background of the toggled header button while it is pressed. The Color parameter wins over it. |
| --bit-MenuButton-disabled-color | --bit-clr-pri-dis-text | Text and icon color when the menu button is disabled, and of the divider between the two halves then. The Color parameter wins over it. |
| --bit-MenuButton-disabled-background | --bit-clr-pri-dis (Fill), transparent (Outline, Text) | Background when the menu button is disabled. The Color parameter wins over it in Fill; the transparent background of Outline and Text is its alone. Shared by the three variants: --bit-MenuButton-fill-disabled-background, --bit-MenuButton-outline-disabled-background and --bit-MenuButton-text-disabled-background are read ahead of it. |
| --bit-MenuButton-disabled-border-color | The disabled background | Border color when the menu button is disabled. The Color parameter wins over it, except over the transparent border of Text. Shared by the three variants: --bit-MenuButton-fill-disabled-border-color, --bit-MenuButton-outline-disabled-border-color and --bit-MenuButton-text-disabled-border-color are read ahead of it. |
| --bit-MenuButton-fill-color | --bit-MenuButton-color | Text and icon color of both halves at rest of a Fill menu button alone, read ahead of --bit-MenuButton-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-background | --bit-MenuButton-background | Background at rest of a Fill menu button alone, read ahead of --bit-MenuButton-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-border-color | --bit-MenuButton-border-color | Border color of a Fill menu button alone, read ahead of --bit-MenuButton-border-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-hover-color | --bit-MenuButton-hover-color | Text and icon color of the hovered half (pointer devices only) of a Fill menu button alone, read ahead of --bit-MenuButton-hover-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-hover-background | --bit-MenuButton-hover-background | Background of the hovered half (pointer devices only) of a Fill menu button alone, read ahead of --bit-MenuButton-hover-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-active-color | --bit-MenuButton-active-color | Text and icon color of a pressed half, and of the chevron while the menu is open, of a Fill menu button alone, read ahead of --bit-MenuButton-active-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-active-background | --bit-MenuButton-active-background | Background of a pressed half, and of the chevron while the menu is open, of a Fill menu button alone, read ahead of --bit-MenuButton-active-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-disabled-background | --bit-MenuButton-disabled-background | Background when disabled of a Fill menu button alone, read ahead of --bit-MenuButton-disabled-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-fill-disabled-border-color | --bit-MenuButton-disabled-border-color | Border color when disabled of a Fill menu button alone, read ahead of --bit-MenuButton-disabled-border-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-color | --bit-MenuButton-color | Text and icon color of both halves at rest of an Outline menu button alone, read ahead of --bit-MenuButton-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-background | --bit-MenuButton-background | Background at rest of an Outline menu button alone, read ahead of --bit-MenuButton-background so a theme can set this variant apart from the other two. The Color parameter leaves it alone. |
| --bit-MenuButton-outline-border-color | --bit-MenuButton-border-color | Border color of an Outline menu button alone, read ahead of --bit-MenuButton-border-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-hover-color | --bit-MenuButton-hover-color | Text and icon color of the hovered half (pointer devices only) of an Outline menu button alone, read ahead of --bit-MenuButton-hover-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-hover-background | --bit-MenuButton-hover-background | Background of the hovered half (pointer devices only) of an Outline menu button alone, read ahead of --bit-MenuButton-hover-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-active-color | --bit-MenuButton-active-color | Text and icon color of a pressed half, and of the chevron while the menu is open, of an Outline menu button alone, read ahead of --bit-MenuButton-active-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-active-background | --bit-MenuButton-active-background | Background of a pressed half, and of the chevron while the menu is open, of an Outline menu button alone, read ahead of --bit-MenuButton-active-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-outline-disabled-background | --bit-MenuButton-disabled-background | Background when disabled of an Outline menu button alone, read ahead of --bit-MenuButton-disabled-background so a theme can set this variant apart from the other two. The Color parameter leaves it alone. |
| --bit-MenuButton-outline-disabled-border-color | --bit-MenuButton-disabled-border-color | Border color when disabled of an Outline menu button alone, read ahead of --bit-MenuButton-disabled-border-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-text-color | --bit-MenuButton-color | Text and icon color of both halves at rest of a Text menu button alone, read ahead of --bit-MenuButton-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-text-background | --bit-MenuButton-background | Background at rest of a Text menu button alone, read ahead of --bit-MenuButton-background so a theme can set this variant apart from the other two. The Color parameter leaves it alone. |
| --bit-MenuButton-text-border-color | --bit-MenuButton-border-color | Border color of a Text menu button alone, read ahead of --bit-MenuButton-border-color so a theme can set this variant apart from the other two. The Color parameter leaves it alone. |
| --bit-MenuButton-text-hover-color | --bit-MenuButton-hover-color | Text and icon color of the hovered half (pointer devices only) of a Text menu button alone, read ahead of --bit-MenuButton-hover-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-text-hover-background | --bit-MenuButton-hover-background | Background of the hovered half (pointer devices only) of a Text menu button alone, read ahead of --bit-MenuButton-hover-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-text-active-color | --bit-MenuButton-active-color | Text and icon color of a pressed half, and of the chevron while the menu is open, of a Text menu button alone, read ahead of --bit-MenuButton-active-color so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-text-active-background | --bit-MenuButton-active-background | Background of a pressed half, and of the chevron while the menu is open, of a Text menu button alone, read ahead of --bit-MenuButton-active-background so a theme can set this variant apart from the other two. The Color parameter wins over it. |
| --bit-MenuButton-text-disabled-background | --bit-MenuButton-disabled-background | Background when disabled of a Text menu button alone, read ahead of --bit-MenuButton-disabled-background so a theme can set this variant apart from the other two. The Color parameter leaves it alone. |
| --bit-MenuButton-text-disabled-border-color | --bit-MenuButton-disabled-border-color | Border color when disabled of a Text menu button alone, read ahead of --bit-MenuButton-disabled-border-color so a theme can set this variant apart from the other two. The Color parameter leaves it alone. |
| --bit-MenuButton-focus-color | --bit-clr-pri-focus | Focus ring color of the button. The Color parameter wins over it. While it is unset, the focus ring is the library's own --bit-shd-focus-ring, so replacing that token re-shapes it too. |
| --bit-MenuButton-min-height | --bit-siz-ctrl-md | 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. The Size parameter wins over it. |
| --bit-MenuButton-padding | --bit-siz-ctrl-pad-y-md --bit-siz-ctrl-pad-x-sm | Padding of each half of the button. The chevron half drops the side padding, since it is a square. The Size parameter wins over it. |
| --bit-MenuButton-gap | 0.5rem | Room between the icon, the text and the chevron. |
| --bit-MenuButton-font-size | --bit-tpg-fs-sm | Text size of the button and of the items, which inherit it from the callout. The Size parameter wins over it. |
| --bit-MenuButton-icon-size | --bit-siz-icon-md | Size of every glyph the component draws: the header icon, the chevron, the spinner, an item icon and a check mark. The Size parameter wins over it. |
| --bit-MenuButton-chevron-width | The min-height of the button | Width of the chevron half of a split button. The Size parameter wins over it. |
| --bit-MenuButton-divider-color | --bit-MenuButton-color, then --bit-clr-pri-text (Fill); --bit-MenuButton-border-color, then --bit-clr-pri (Outline); --bit-clr-pri (Text) | The hairline between the two halves of a split button. The Color parameter wins over it, and a disabled menu button draws it in the disabled color. Shared by the three variants: --bit-MenuButton-fill-divider-color, --bit-MenuButton-outline-divider-color and --bit-MenuButton-text-divider-color are read ahead of it. |
| --bit-MenuButton-fill-divider-color | --bit-MenuButton-divider-color | The hairline between the two halves of a Fill menu button alone, read ahead of --bit-MenuButton-divider-color so a theme can set this variant apart from the other two. The Color parameter wins over it, and a disabled menu button draws it in the disabled color. |
| --bit-MenuButton-outline-divider-color | --bit-MenuButton-divider-color | The hairline between the two halves of an Outline menu button alone, read ahead of --bit-MenuButton-divider-color so a theme can set this variant apart from the other two. The Color parameter wins over it, and a disabled menu button draws it in the disabled color. |
| --bit-MenuButton-text-divider-color | --bit-MenuButton-divider-color | The hairline between the two halves of a Text menu button alone, read ahead of --bit-MenuButton-divider-color so a theme can set this variant apart from the other two. The Color parameter wins over it, and a disabled menu button draws it in the disabled color. |
| --bit-MenuButton-callout-background | --bit-clr-bg-pri | Background of the callout, and of every submenu opened from inside it. The Background parameter wins over 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-md | Smallest height of an item. The Size parameter wins over it. |
| --bit-MenuButton-item-padding | --bit-siz-ctrl-pad-y-md --bit-siz-ctrl-pad-x-sm | Padding of an item, and of a group header. The Size parameter wins over it. |
| --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 | --bit-clr-pri | The mark of a checked item: the check mark of a check item, the bullet of a single-choice one. The Color parameter wins over it. |
| --bit-MenuButton-item-disabled-color | --bit-clr-fg-dis | Text and icon color of a disabled item. |
| --bit-MenuButton-item-focus-color | --bit-clr-pri-focus | Focus ring of the item the keyboard navigation is on. It is drawn inside the item, since the callout clips what overflows it. The Color parameter wins over 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. |
API
Every parameter, public member, sub-class and enum this component exposes.
BitMenuButton 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. An explicit value wins over --bit-MenuButton-callout-background; left unset, the callout takes the primary background unless it says otherwise. |
| ButtonType | BitButtonType? | null | The value of the type attribute of the items, and of the main half of a split menu button when it is set. Left unset, the items are submit buttons inside an EditForm and plain buttons elsewhere; a submit or reset item acts on the form the menu button sits in, although its open menu is moved out of it to the body. |
| 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. An explicit value wins over the --bit-MenuButton-* color variables, the toggled ones and the item focus and check mark colors included; left unset, the menu button is primary unless they say otherwise. |
| 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. |
| NewTabHint | string? | null | Replaces the visually hidden "(opens in a new tab)" an item whose Target is _blank is announced with, e.g. to translate it. An empty value removes it. |
| NoIcon | bool | false | If true, the icon of the header button is hidden. |
| NoNewTabHint | bool | false | Stops the items whose Target is _blank from announcing that they open a new tab - only for where a visible label or heading already says so. |
| 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. An explicit value wins over the --bit-MenuButton-* size variables, the item ones included; left unset, the menu button is medium unless they say otherwise. |
| 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. |
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. |
| Disabled | bool | false | Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction. |
| 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. An attribute written on the component wins over an entry of the same name. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| 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. |
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. |
| IsDisabled | BitNameSelectorPair<TItem, bool> | new(nameof(BitMenuButtonItem.IsDisabled)) | IsDisabled 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. |
| Rel | BitNameSelectorPair<TItem, BitLinkRels?> | new(nameof(BitMenuButtonItem.Rel)) | The Rel 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. |
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. |
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. |
BitDropDirection enum
| Name | Value | Description |
|---|---|---|
| All | 0 | The direction determined automatically based on the available spaces in all directions. |
| TopAndBottom | 1 | The direction determined automatically based on the available spaces in only top and bottom directions. |
BitLinkRels enum
| Name | Value | Description |
|---|---|---|
| Alternate | 1 | Provides a link to an alternate representation of the document. (i.e. print page, translated or mirror) |
| Author | 2 | Provides a link to the author of the document. |
| Bookmark | 4 | Permanent URL used for bookmarking. |
| External | 8 | Indicates that the referenced document is not part of the same site as the current document. |
| Help | 16 | Provides a link to a help document. |
| License | 32 | Provides a link to licensing information for the document. |
| Next | 64 | Provides a link to the next document in the series. |
| NoFollow | 128 | Links to an unendorsed document, like a paid link. ("NoFollow" is used by Google, to specify that the Google search spider should not follow that link) |
| NoOpener | 256 | Requires that any browsing context created by following the hyperlink must not have an opener browsing context. |
| NoReferrer | 512 | Makes the referrer unknown. No referrer header will be included when the user clicks the hyperlink. |
| Prev | 1024 | The previous document in a selection. |
| Search | 2048 | Links to a search tool for the document. |
| Tag | 4096 | A tag (keyword) for the current document. |
| Me | 8192 | Indicates that the linked document represents the person who owns the current content. (used for identity verification) |
| Opener | 16384 | Requires that any browsing context created by following the hyperlink keeps its opener browsing context. (reverses the implicit noopener modern browsers apply to _blank targets) |
| PrivacyPolicy | 32768 | Links to the privacy policy that applies to the current document. (rendered as privacy-policy) |
| Sponsored | 65536 | Marks the link as an advertisement or paid placement, so search engines do not count it as an organic endorsement. |
| TermsOfService | 131072 | Links to the terms of service that apply to the current document. (rendered as terms-of-service) |
| Ugc | 262144 | Marks the link as user-generated content, like forum posts or comments, for search engines. |
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. |
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.