Menu item
One entry of a MenuComponent.
Rendered as an anchor; an entry with a command and no Url is still one, just without an href. An entry may carry an address and a command both (IEntryLinkComponent).
new MenuItemComponent("menu-item")
Properties
| Property | Type | Default | Binding | Description |
|---|---|---|---|---|
| Own | ||||
KindSetKind | UIMenuItemKind? | UIMenuItemKind.Item | — | Whether this entry renders as an entry, a section caption or a rule. Render-time only, not bindable: the menu already picks a template variant from IMenuItemModel.Kind. |
SelectedSetSelected · BindSelected | bool? | false | one-way | Whether this entry is the current one. |
CheckedSetChecked · BindChecked | bool? | false | one-way | Whether a UIMenuItemKind.Check entry is on. |
ValueSetValue · BindValue | UIPhrase | null | one-way | What a UIMenuItemKind.Select entry says at its end. translatable |
InActionBarSetInActionBar · BindInActionBar | bool? | false | one-way | Whether this entry of a context menu also stands in its owner's action bar, as its icon. |
UrlSetUrl · BindUrl | string | null | one-way | The address the component opens when it is pressed, written into the anchor's href; set or bound, the component takes no command on its click — but a host's entry drawn per entry (IEntryLinkComponent) — and holds no control of its own, which an anchor cannot. translatable |
| From ButtonComponent | ||||
VariantSetVariant · BindVariant | UIButtonVariant? | UIButtonVariant.Ghost | one-way | The button's visual variant — Primary, Accent, Danger, Outline, Ghost, Link, or Surface. |
SizeSetSize · BindSize | UIResponsive<UISize>? | Medium | one-way | How much room the button takes, optionally per breakpoint. |
ShortcutSetShortcut · BindShortcut | string | null | one-way | The key chord that presses the control from anywhere on the page, written as Ctrl+Shift+P; a context menu's entry presses it for the row under the keyboard.Not translatable: a chord names physical keys. A literal one is checked when the view compiles. |
PressedSetPressed · BindPressed | bool? | null | two-way | Whether the button is a toggle and its pressed state: null is an ordinary button, true/false a toggle; two-way, so a press writes back. |
SubmitFormIdSetSubmitFormId · BindSubmitFormId | string | null | one-way | The id of the form this button submits, scoping the Submit-trigger validation that runs before the click command. |
OpensDrawerSetOpensDrawer | UISide? | null | — | The side whose drawer the button opens and puts away (UIViewOptions.SideDrawers), left or right.Render-time only. The page's own button for that side, then, is this one: the shell draws none, so a header collapsed on a phone leaves no band behind for it. Shown only where the side is a drawer — below the width the view names, unpinned, and never where a left side is the bottom bar — the button is as expanded as the drawer is open, and the keyboard comes back to it when the drawer goes. |
PinsDrawerSetPinsDrawer | UISide? | null | — | The side whose drawer the button pins and unpins (UIViewOptions.SideDrawers), left or right: pinned, the side stands in its column from the extra-large breakpoint up, as if the screen were wide.Render-time only. A side with no sidebar menu to carry a pin ( MenuComponent.DrawerPin) is pinned by a button of the page's own, standing wherever the side's heading is. Shown only where pinning means something — from the extra-large breakpoint up, where the side is a drawer or pinned, and never for a left side that is the bottom bar — it is as pressed as the side is pinned. The pin is kept in the browser under the first authored id in the side, so the side's root wants an id of its own. The button is a toggle whose ButtonComponent.Pressed is the pin, which an interaction may read for an icon of its own for pinned. |
BackgroundSetBackground · BindBackground | UIThemeColor? | null | one-way | The surface's background colour; unset leaves whatever the theme paints underneath. |
PaddingSetPadding · BindPadding | UIResponsive<UIThickness>? | null | one-way | The inner spacing between this component's edges and its content, optionally overridden per breakpoint. |
BackgroundImageSetBackgroundImage · BindBackgroundImage | string | null | one-way | The picture painted over the background colour, centred and never repeated: a URL or a data URI. |
BackgroundImageFitSetBackgroundImageFit · BindBackgroundImageFit | UIImageFit? | UIImageFit.Cover | one-way | How the picture fills the surface. |
BackgroundImageDimSetBackgroundImageDim · BindBackgroundImageDim | double? | null | one-way | How far the picture is dimmed, from 0 (not at all) to 1 (gone): the ground the content reads on, laid over it — darker in a dark theme, lighter in a light one. Drawn by the browser; unset, the picture is not dimmed. |
BackgroundImageDimModeSetBackgroundImageDimMode · BindBackgroundImageDimMode | UIBackgroundDimMode? | UIBackgroundDimMode.Uniform | one-way | How ISurfaceComponent.BackgroundImageDim is spread over the picture: evenly, or at the edges alone. |
BackgroundImageBlurSetBackgroundImageBlur · BindBackgroundImageBlur | double? | null | one-way | The blur of the picture, in the platform's device-independent units, zero or more; the content over it stays sharp. Drawn by the browser; unset, the picture is not blurred. |
BorderColorSetBorderColor · BindBorderColor | UIThemeColor? | null | one-way | The border's colour, written as CSS border-color; unset leaves the stylesheet's own. |
BorderThicknessSetBorderThickness · BindBorderThickness | UIResponsive<UIThickness>? | null | one-way | The border's thickness, optionally overridden per breakpoint; unset leaves the stylesheet's own. A frame on a wide screen may run edge to edge on a phone: SetBorderThickness(UIThickness.Uniform(0), md: UIThickness.Uniform(1)). |
BorderRadiusSetBorderRadius · BindBorderRadius | UIResponsive<UICornerRadius>? | null | one-way | The corner rounding, optionally overridden per breakpoint; unset leaves the stylesheet's own. |
OverflowSetOverflow · BindOverflow | UIOverflow? | UIOverflow.Hidden | one-way | Whether content that overflows this component's bounds is clipped. |
DescriptionPlainSetDescriptionPlain | bool? | false | — | Whether the description is shown as written, its asterisks, brackets and braces as characters, rather than read as inline markup: words a person typed — a chat's message, an error's text from an address — bound to it; unset, it is markup. Render-time only: the first paint and every value pushed later are written the same way. |
DescriptionAutolinksSetDescriptionAutolinks | bool? | false | — | Whether a bare http:// or https:// address in the description is a link, as [words](address) is; unset, it is text. ITextComponent.DescriptionPlain wins over it.Render-time only: the first paint and every value pushed later are read the same way. An address in a phrase's argument links too, escaped or not. |
HeadingLevelSetHeadingLevel | int? | null | — | The heading level (1 through 6) the title stands at in the page's outline; unset, the title is plain text. Render-time only: the title's element ( h1 through h6) is chosen when the block is drawn. |
TooltipPlainSetTooltipPlain | bool? | false | — | Whether the tooltip is shown as written, its asterisks, brackets and braces as characters, rather than read as inline markup: words the controller holds bound to it — a person's name, a note's status; unset, it is markup. Render-time only: the first paint and every value pushed later are shown the same way. |
DescriptionSetDescription · BindDescription | UIPhrase | null | one-way | The secondary text. translatable |
DescriptionTypeSetDescriptionType · BindDescriptionType | UITextAppearance? | Caption | one-way | The secondary text type. |
DescriptionColorSetDescriptionColor · BindDescriptionColor | UIThemeColor? | Muted | one-way | The secondary text color. |
TextAlignmentSetTextAlignment · BindTextAlignment | UITextAlignment? | UITextAlignment.Start | one-way | How the title and description align within their box — Start, Center, End, or Justify; default Start. |
IconSetIcon · BindIcon | string | null | one-way | The icon shown before the title, by name from the registered icon font/set. |
IconColorSetIconColor · BindIconColor | UIThemeColor? | Default | one-way | The leading icon's colour, defaulting to ITextBaseModel.DefaultIconColor. |
IconSizeSetIconSize · BindIconSize | UISize? | null | one-way | The leading icon size; left unset the glyph is as tall as the title beside it. |
IconShapeSetIconShape · BindIconShape | UIShape? | null | one-way | The shape a leading icon that is a picture is drawn in — UIShape.Circle for a person's avatar; a glyph keeps its own. |
IconFallbackSetIconFallback · BindIconFallback | string | null | one-way | The glyph a picture icon shows while it has no picture — a round one (ITextBaseModel.IconShape Circle) none given or one that fails, any other one that fails; unset, UIGlyphs.Person on a round one and UIGlyphs.Image on any other. |
TitleSetTitle · BindTitle | UIPhrase | null | one-way | The label text drawn as the title; nothing renders when it is unset. translatable A string (an author's text) or a UIPhrase, as every text of the model contracts is — the description, the tooltip, the badge's title and tooltip, a select entry's value — so a moment can stand in it. |
TitleTypeSetTitleType · BindTitleType | UITextAppearance? | Body | one-way | The primary text type. |
TitleColorSetTitleColor · BindTitleColor | UIThemeColor? | Default | one-way | The primary text colour, which also colours the icon unless IconColor is set, and the description when ITextModel.DescriptionColor is set to UIColorStyle.Default. |
BadgePlacementSetBadgePlacement · BindBadgePlacement | UITextBadgePlacement? | UITextBadgePlacement.Trailing | one-way | Where badge content is placed. |
BadgeVariantSetBadgeVariant · BindBadgeVariant | UIBadgeVariant? | UIBadgeVariant.Info | one-way | The badge visual variant. |
BadgeColorSetBadgeColor · BindBadgeColor | UIThemeColor? | null | one-way | The badge's own colour, overriding IBadgeModel.BadgeVariant when set — a tag or a category swatch, which the closed variant enum cannot name. |
BadgeFillSetBadgeFill · BindBadgeFill | UIBadgeFill? | null | one-way | How the badge spends its colour; unset, a variant fills and a IBadgeModel.BadgeColor tints. A plain badge ignores it. |
BadgeIconSetBadgeIcon · BindBadgeIcon | string | null | one-way | The icon shown beside the badge's title, by name from the registered icon font/set. |
BadgeIconColorSetBadgeIconColor · BindBadgeIconColor | UIThemeColor? | Default | one-way | The badge icon's colour, defaulting to IBadgeModel.DefaultBadgeIconColor. |
BadgeIconSizeSetBadgeIconSize · BindBadgeIconSize | UISize? | null | one-way | The badge icon size. Left unset the glyph is as tall as the badge's title. |
BadgeTitleSetBadgeTitle · BindBadgeTitle | UIPhrase | null | one-way | The short text drawn inside the badge, beside its icon. translatable |
BadgeTitleTypeSetBadgeTitleType · BindBadgeTitleType | UITextAppearance? | Overline | one-way | The role of the badge's title, defaulting to IBadgeModel.DefaultBadgeTitleType. |
BadgeTooltipSetBadgeTooltip · BindBadgeTooltip | UIPhrase | null | one-way | The tooltip for the badge content. translatable |
BadgeTooltipPlacementSetBadgeTooltipPlacement · BindBadgeTooltipPlacement | UIPopupPlacement? | UIPopupPlacement.Top | one-way | The side the badge's own tooltip prefers, placed against the badge rather than against the row. |
TooltipSetTooltip · BindTooltip | UIPhrase | null | one-way | The tooltip shown on hover and focus; on an icon button with no title, it also names the control for screen readers. translatable |
TooltipPlacementSetTooltipPlacement · BindTooltipPlacement | UIPopupPlacement? | UIPopupPlacement.Top | one-way | The side the tooltip prefers; flips to the opposite side when there is no room for it there. |
IconAlignmentSetIconAlignment | UITextIconAlignment? | UITextIconAlignment.Content | — | Where the leading icon sits against the text beside it: Content (the default) centres it across title and description, while Title keeps it on the title's own line. |
BadgeAlignmentSetBadgeAlignment | UITextBadgeAlignment? | UITextBadgeAlignment.Title | — | Where a trailing badge sits against the text beside it: Title (default) keeps it at the title line's end; Content centres it across title and description. |
AccessibleNameSetAccessibleName · BindAccessibleName | UIPhrase | null | one-way | The name a screen reader announces in place of the visible words; unset, the control is named by what it shows. The set is a wrapper's hand (a labelled control is named by its label), an author's own words said at the component. translatable |
Events
OnClickShowingLoading(string command)- Runs the command on click and shows the button loading for exactly the round trip, via two client interactions with nothing to bind or clear.
Named for what it shows, not what it carries — unlikeWithmethods, nothing is passed here. OnClickShowingLoading(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Runs the command with UI action arguments on click and shows the button loading for exactly the round trip.
OnClickShowingLoadingLiteral(string command, params KeyValuePair<string, object>[] arguments)- Runs the command with literal argument values on click and shows the button loading for exactly the round trip.
OnClickShowingLoadingWithItemKey(string command, string argumentName = "id")- Runs the command on click with the key of the item the button is drawn for, and shows the button loading for exactly the round trip — a row's own button.
OnClick(string command)- Registers a click handler that invokes the specified command.
OnClick(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a click handler that invokes the specified command with UI action arguments.
OnClickLiteral(string command, params KeyValuePair<string, object>[] arguments)- Registers a click handler that invokes the specified command with literal argument values.
OnClickWithItemKey(string command, string argumentName = "id")- Runs the command on click with the key of the item the button is drawn for — a row's own button.
OnSubmitShowingLoading(string formId, string command)- Submits the form
formIdon click, asButtonComponent.OnSubmit, and shows the button loading for exactly the command's round trip; a form failing its rules shows nothing. OnSubmitShowingLoading(string formId, string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Submits the form
formIdon click, asButtonComponent.OnSubmit, and shows the button loading for exactly the command's round trip; a form failing its rules shows nothing. OnSubmitShowingLoadingLiteral(string formId, string command, params KeyValuePair<string, object>[] arguments)- Submits the form
formIdon click, asButtonComponent.OnSubmit, and shows the button loading for exactly the command's round trip; a form failing its rules shows nothing. OnSubmit(string formId, string command)- Registers a click command that first runs Submit-trigger validation for every input sharing
formId, dispatching the command only if all of them pass. OnSubmit(string formId, string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a click command that first runs Submit-trigger validation for every input sharing
formId, dispatching the command only if all of them pass. OnSubmitLiteral(string formId, string command, params KeyValuePair<string, object>[] arguments)- Registers a click command that first runs Submit-trigger validation for every input sharing
formId, dispatching the command only if all of them pass.
Methods
ConfigureTemplate(TTemplate? current, Action<TTemplate> configure, string what)- Configures
currentwhen it is aTTemplate, throwing when a different one was set.
Common properties (23) — layout, visibility, theme, and the rest every component shares
| Property | Type | Default | Binding | Description |
|---|---|---|---|---|
VisibilitySetVisibility · BindVisibility | UIResponsive<UIVisibility>? | Visible | one-way | What the component does with the room it was given, optionally overridden per breakpoint (e.g. collapsed from a given width up). Hidden at every width — by a static value or a controller binding — the server refuses a command or a value the component or anything inside it sends. That is a guard against a stale or forged page, not the permission itself: an interaction that hides it ( HiddenWhen) lives on the client alone, so who may act belongs in the command or the setter. |
EnabledSetEnabled · BindEnabled | bool? | true | one-way | Whether the component responds to input; false dims it and marks it, and its subtree, inert. False by a static value or a controller binding, the server refuses a command or a value the component or anything inside it sends. That is a guard against a stale or forged page, not the permission itself: an interaction that disables it ( EnabledWhen) lives on the client alone, so who may act belongs in the command or the setter. |
ThemeSetTheme · BindTheme | UIThemeMode? | null | one-way | The theme mode forced on this component's subtree, or null to inherit the ambient theme. |
HorizontalAlignmentSetHorizontalAlignment · BindHorizontalAlignment | UIResponsive<UIAlignment>? | Stretch | one-way | Where the component sits within its grid cell along the horizontal axis, optionally overridden per breakpoint. |
VerticalAlignmentSetVerticalAlignment · BindVerticalAlignment | UIResponsive<UIAlignment>? | Stretch | one-way | Where the component sits within its grid cell along the vertical axis, optionally overridden per breakpoint. |
WidthSetWidth · BindWidth | UIResponsive<UILayoutLength>? | null | one-way | The component width, optionally overridden per breakpoint. |
MinWidthSetMinWidth · BindMinWidth | UIResponsive<UILayoutLength>? | null | one-way | The component minimum width, optionally overridden per breakpoint. |
MaxWidthSetMaxWidth · BindMaxWidth | UIResponsive<UILayoutLength>? | null | one-way | The component maximum width, optionally overridden per breakpoint. |
HeightSetHeight · BindHeight | UIResponsive<UILayoutLength>? | null | one-way | The component height, optionally overridden per breakpoint. |
MinHeightSetMinHeight · BindMinHeight | UIResponsive<UILayoutLength>? | null | one-way | The component minimum height, optionally overridden per breakpoint. |
MaxHeightSetMaxHeight · BindMaxHeight | UIResponsive<UILayoutLength>? | null | one-way | The component maximum height, optionally overridden per breakpoint. |
ZIndexSetZIndex · BindZIndex | int? | 0 | one-way | The stacking order within the visual tree. |
MarginSetMargin · BindMargin | UIResponsive<UIThickness>? | null | one-way | The outer spacing around the component, optionally overridden per breakpoint. |
PlacementSetPlacement · BindPlacement | UIResponsive<UIGridPlacement>? | null | one-way | The grid placement, optionally overridden per breakpoint. |
AlignWithFieldBoxesSetAlignWithFieldBoxes | UIResponsive<UIFieldBoxAlignment>? | null | — | Whether the component stands level with the boxes of captioned fields beside it — a caption line down, centred on the box — and on which boxes, per breakpoint. Unset, the compiler decides it wherever the component stands side by side with a thing that draws a caption row (UIFieldBoxes); UIFieldBoxAlignment.None keeps it where it is laid out.Render-time only. A panel draws it as its top padding and its least height, anything else as its top margin, set down onto the band's middle; an authored Padding, MinHeight or Margin replaces them. |
LoadingSetLoading · BindLoading | bool? | false | one-way | Whether the component is in loading state — a live state a controller turns on and off. While it holds, by a static value or a controller binding, the server refuses a command or a value the component or anything inside it sends — as the page does. |
LoadingStyleSetLoadingStyle · BindLoadingStyle | UILoadingStyle? | null | one-way | The visual indicator shown while this component or spinner is loading, or null to inherit the ambient or theme loading style. |
ShowContextMenuSetShowContextMenu · BindShowContextMenu | bool? | true | one-way | Whether a right-click opens the IVisualComponent.ContextMenu; on a host with rows, whether it opens any row's. Off, the menu stays in the tree and nothing opens it. |
ActionBarSetActionBar | UIActionBarAlignment? | null | — | How the component's action bar lines up with it, or null for none: the IVisualComponent.ContextMenu's entries marked for the bar (a menu item's InActionBar) as icons, and "more" opening the menu itself, floating above the component once the reader chooses it — a press, a tap, the keyboard's cursor — until a press elsewhere, Escape, or another chosen.A quick view of the menu, not a second list: a press on an icon is that entry's press. Render-time only; a component with an action bar and no context menu is refused when the view compiles. |
ActionBarRepeatInMoreSetActionBarRepeatInMore | bool? | true | — | Whether the menu the IVisualComponent.ActionBar's "more" opens repeats the entries the bar shows (the default), or holds the rest alone — no caption or rule left with nothing to stand over or between. A right-click and a long press open the whole menu either way, and a bar whose menu holds nothing more draws no "more".Render-time only. |
ScrollGroupSetScrollGroup · BindScrollGroup | string | null | one-way | The scroll group this component belongs to: every component sharing the name scrolls together. Driven by whichever one the reader scrolls. Components that mark their shown source lines (e.g. a code field and a Markdown display) sync line-for-line; otherwise by scroll fraction. |
TextSelectableSetTextSelectable · BindTextSelectable | bool? | null | one-way | Whether the reader can select the words in this component and everything inside it: true lets them (a table whose cells are copied, a chat bubble), false keeps them out; unset, the place decides — a Text's and a Paragraph's words and a validation message select, unless they stand in a row, a menu or another control, and nothing else does. The nearest component that says wins. A control's own words (a button's label, a tab, a menu entry, a field's caption), a surface the pointer drags (a row that drags by itself, a canvas, a grip) and, on a touch screen, anything a long press opens a menu on never select; a field's value always does. |
WindowFootSetWindowFoot | bool? | null | — | Whether this component is the window's foot (a chat's composer, a pane's last row): where it stands at the window's bottom edge the phone's system bar takes its background colour, dimmed by any open modal drawer or dialog veil, and its content sits above the bar. The page's bottom bar is one by itself. Render-time only. |