NE.Standard

Presets

NE.Standard.UI.Extensions is a package of presets: static classes and extension methods that build the arrangements a screen writes over and over — a header band, a titled section, a list beside the thing chosen in it, a card alone on a page, a message that stays in the page, two fields on one line, a pair of buttons at a form's foot — out of the built-in components. A preset holds a look in one place: where a width, a breakpoint or a spacing has to be chosen, the preset chooses it, so two screens built with it stand alike and an author does not pick one of their own. It adds no component of its own. Each preset returns an ordinary built-in — a stack panel, a container, a card, an expander, a surface, a status, a dialog, a button, a split button, a menu item, a text, a paragraph, a key-value list or one of its rows — so everything they build is already rendered by the platform, and the package is server-only. A returned component takes the usual Set*, Bind* and On* calls after it, like any other.

It is installed separately:

dotnet add package NE.Standard.UI.Extensions

Like every package here it brings its namespace, NE.Standard.UI.Extensions, as a global using, so nothing below needs a using line; a project that sets NEStandardUIImplicitUsings to false writes its own.

A screen written with them

The same form without presets is a tree of stack panels, spacings and placements. With them it reads as the page it describes: sections down a column, two fields to a line, the address folded away while a box is ticked, and the buttons at the foot.

internal sealed class ShippingView : UIViewBase, IUIViewDefinition
{
    private const string FormId = "shipping";
    private const string SameAddressId = "shipping-same-address";

    public static string ViewKey => "shipping";

    protected override IVisualComponent? CreateHeader()
        => UIPage.Header("Shipping", "Where the parcel goes, and who signs for it.");

    protected override IVisualComponent CreateContent()
        => UILayout.Split(CreateForm(), CreateSummary(), sideSpan: 9);

    private static StackPanelComponent CreateForm()
        => UILayout.Stack(28,
            UIPage.Section("Recipient", null,
                UIForm.Row(
                    new TextInputComponent().SetTitle("First name").SetFormId(FormId).BindValue(nameof(ShippingController.FirstName)),
                    new TextInputComponent().SetTitle("Last name").SetFormId(FormId).BindValue(nameof(ShippingController.LastName))
                )
            ),
            UIPage.Section("Invoice address", "Only when it differs from the delivery address.",
                new CheckboxComponent(SameAddressId)
                    .SetTitle("Invoice goes to the delivery address")
                    .BindValue(nameof(ShippingController.SameAddress)),
                UILayout.Stack(16,
                    new TextInputComponent().SetTitle("Street and number").SetFormId(FormId).BindValue(nameof(ShippingController.Street)),
                    UIForm.Row(
                        new TextInputComponent().SetTitle("City").SetFormId(FormId).BindValue(nameof(ShippingController.City)),
                        new TextInputComponent().SetTitle("Postcode").SetFormId(FormId).BindValue(nameof(ShippingController.Postcode))
                    )
                )
                .ShownWhen(SameAddressId, false)
            ),
            UIButtons.Pair(
                UIButtons.Ghost("Back"),
                UIButtons.Primary("Continue").OnSubmit(FormId, nameof(ShippingController.ContinueAsync))
            )
        );

    private static CardComponent CreateSummary()
        => UICard.Create("Your order", "Shipped within two working days.", UIDetails.List(
            ("Items", "3"),
            ("Weight", "2.4 kg"),
            ("Delivery", "Standard")
        ));
}

examples/DemoApp/Views/Screens/CheckoutView.cs in the repository is a full screen built this way.

UIPage — the regions of a page

A bound twin with things after its paths (trailing, content, actions) has two overloads: one without a scope, reading the controller's paths, and one with UIBindingScope scope after the words' paths, written [UIBindingScope scope,] below — a row's own words in an item template. A twin with nothing after its paths takes scope = Root as an optional parameter. Every preset taking a binding path (Bound* and UILayout.Panes) also has a typed <TSource> overload taking Expression<Func<TSource, object?>> selectors.

Preset Builds
Header(UIPhrase title, UIPhrase? description = null, params IVisualComponent[] trailing) The band a page is headed by: the title, a muted line under it, and whatever is passed as trailing (a theme switcher, the signed-in person, the page's buttons) at the far end of the title's row — on a phone, buttons with words (ButtonComponent with a title) stand on a row of their own under the line, at the far edge, since two of them beside the title left it a few letters a line; icons stay on the title's row. From the medium breakpoint the title is in the display role on one line and the line runs to three lines under the title's columns. On a phone (below the medium breakpoint) the title is a title's size and wraps under itself between words when it is too long for its row (a single word longer than the row ends in an ellipsis, never breaks), its first line level with the far end, and the line is one line, cut — its whole words its tooltip, a long press away — under the whole band — so the band stays about a title's height (74 px at 390 px with two switchers) and leaves the screen to the page; its top padding there puts the title on the middle of the shell's drawer toggle. Keep a phone's far end to two or three controls: whatever it takes, the title gives up. Returns a ContainerComponent, usually from CreateHeader().
Header(IVisualComponent leading, UIPhrase title, UIPhrase? description = null, params IVisualComponent[] trailing) The same band led by an action before the title — UIIconButtons.Back() on a page reached from another — on the title's row at every width; the title and the line start after it, and its glyph stands on the content's 24 px edge. The action's cell is shown as the action is, so a Back shown only on a phone (ShownBelow(UIResponsiveTier.Md)) leaves the title on the content's edge from md. On a phone it follows the shell's drawer toggle where the view has one: the toggle, a step of 8 px, Back, then the title. The leading action comes first in the band's order, so the keyboard reaches it before the far end.
BoundHeader(IVisualComponent? leading, string titlePath, string? descriptionPath = null, [UIBindingScope scope,] params IVisualComponent[] trailing) The band with a title and a line the controller holds — a note's name, its status — bound at the two paths (the phone's cut line's tooltip too) as the thing's own words, never looked up as a key (a path holding a UIPhrase still translates) and the line drawn as written, not read as markup; led by leading where one is given.
Header(UIHeaderSize size, IVisualComponent? leading, UIPhrase title, UIPhrase? description = null, params IVisualComponent[] trailing), BoundHeader(UIHeaderSize size, …) UIHeaderSize.Strip is a panel's caption over the list or the tree in it — an explorer's "Files": the name a muted label (the overline role), set in by a list row's 8 px so it stands over a list's words and a tree's chevrons, the far end on its row — its buttons with no size said small: an icon button, a menu button, a switcher, one with words, and those in a row. UIHeaderSize.Page is the band above. UIHeaderSize.Pane is the title row of a pane beside a list or a tree — a conversation's, an open note's — the same at every width: the name one line in the subtitle role, cut with its whole words as its tooltip; the description a muted caption beside it (a status: "Not saved"); the far end on the same row; no edge of its own, the pane's padding being it. leading stands before the name: UIIconButtons.Back().ShownBelow(UIResponsiveTier.Md) where a phone has no list beside the pane, a round picture (an ImageComponent with UIShape.Circle, 32 px, the person glyph where it has no picture), or both in a UILayout.Row. A bound name and caption are the thing's own words, never looked up as a key; a caption path holding a UIPhrase still translates ("Not saved" in the reader's language).
Section(UIPhrase title, UIPhrase? description, params IVisualComponent[] content), BoundSection(string titlePath, string? descriptionPath, [UIBindingScope scope,] params IVisualComponent[] content) A titled part of a page: the heading, an optional muted line, and the content below it. The heading and its note sit closer to each other than to the content; a long title wraps. The bound one takes the words the controller holds, as content.
Heading(UIPhrase title, UIPhrase? description = null, params IVisualComponent[] trailing), BoundHeading(string titlePath, string? descriptionPath = null, [UIBindingScope scope,] params IVisualComponent[] trailing), Heading(IVisualComponent heading, params IVisualComponent[] trailing), Section(IVisualComponent heading, params IVisualComponent[] content) A section's heading with things at its far end — the + that adds to the list under it, a menu, a sample's source — the title taking the rest of the row and the far end on its line, the muted line under both: under the far end too on a phone, beside it from md, as a page header's; buttons with words go under the line on a phone. BoundHeading binds the words as content; the component overload is UILayout.Ends round a heading of your own (a title with a badge). Section(heading, …) stands it over the content.
Fold(UIPhrase? title, bool expanded, params IVisualComponent[] content), BoundFold(string titlePath, [UIBindingScope scope,] bool expanded, params IVisualComponent[] content) The collapsible sibling of Section: the quiet expander (UIExpanderVariant.Quiet) — the name a muted caption with the chevron after it, no card — over the content in a stack 12 px apart, open or folded to begin with. For the advanced part of a form, a step of a narrow panel, a model's thinking under a message. Returns the ExpanderComponent: .BindExpanded(path) follows the controller, ConfigureDefaultHeader(header => header.SetIcon(…)) adds a mark, and a null title leaves the name to a binding — ConfigureDefaultHeader(header => header.BindTitle(path)).
Labelled(UIPhrase label, IVisualComponent content, bool wrap = false), BoundLabelled(string labelPath, [UIBindingScope scope,] IVisualComponent content, bool wrap = false) A component under an overline label: a value, a sample, a control with no title of its own. A control that takes an AccessibleName and has neither a visible name nor an AccessibleName of its own is named by the label (BoundLabelled binds its name to labelPath); a name or title said at the component wins. The label keeps one line; wrap lets a label that is a sentence run on. Its label and gap stand as tall as a field's caption, so in UIForm.Row it counts as captioned and its content stands level with the fields' boxes.
Empty(string? icon, UIPhrase title, UIPhrase? description = null, params IVisualComponent[] actions), BoundEmpty(string? icon, string titlePath, string? descriptionPath = null, [UIBindingScope scope,] params IVisualComponent[] actions) Where something would be and nothing is yet — a pane before a row is chosen, a page with nothing made, a chat with no messages: the list's own empty state, the same component (DefaultEmptyTemplate: the icon in the brand's colour where one is given, the words at its side — words alone, centred, with none — the body title in the text's own ink, the muted caption under it, both wrapping), the ways on in a row centred under the words, each as wide as it is, the block in the middle of the room it is given (a ContainerComponent as tall as its parent), running on past its end, never its top, where the room is shorter than it. No surface of its own. The bound one takes the words the controller holds, as content.
Outcome(string? icon, UIColorStyle tone, UIPhrase title, [UIPhrase? description,] params IVisualComponent[] actions), Outcome(…, ParagraphComponent? description, …), BoundOutcome(string? icon, UIColorStyle tone, string titlePath, string? descriptionPath, [UIBindingScope scope,] params IVisualComponent[] actions) What came of a press, in place of the form it ends — "Check your inbox", "Order placed", "Not for this account": a Surface panel, 24 px in, the mark in the tone's colour (icon, else the tone's own) before the title in the title role, the line a muted caption under it (a paragraph of your own in the second overload, the controller's words in BoundOutcome), and the ways on at the far end, the safe one first, wrapping as UIButtons.Pair does. A status to a screen reader, an alert for Warning and Danger, so it is read as it replaces the form. One on an empty page is UICard.Centered(outcome).
Status(string? icon, UIColorStyle tone, UIPhrase title, UIPhrase? description, params IVisualComponent[] actions), BoundStatus(string? icon, UIColorStyle tone, string titlePath, string? descriptionPath, [UIBindingScope scope,] params IVisualComponent[] actions) A page's state standing in for all of it — not found, refused, failed — as the framework's own not-found and error pages draw theirs (StatusComponent): the mark on a faint disc in the tone's colour (icon, else the tone's own), the title, the line under it and the ways on, the safe one first, centred. A line the controller says is bound through the returned component's Words.
Band(IVisualComponent content) A band across the content in the brand's faint tint (UISurfaceStyle.Tinted), 16 px in and 12 down: the filters over a list, the question at an article's foot.
Column(UIColumnWidth width, IVisualComponent content, bool centered = false) The content kept to a column from the content's edge, or in the middle where centered, however wide the page: UIColumnWidth.Reading (720 px — an article, a settings page of cards), Form (440 px — a short form; UICard.Centered and UIDialogs.Form take it) or Wide (1080 px — a form beside its summary). One of three, never a width of the page's own.
InColumn(this ContainerComponent band, UIColumnWidth width) A header band over a centred column — UIPage.Header(…).InColumn(UIColumnWidth.Reading) — the column's width with the band's own side padding outside it, in the middle, so the band's words stand over the column's edge at every width. The header region and the content share an axis only where no side stands beside one and not the other (full-height sides, or no pinned side), and the content region keeps its scrollbar's gutter.
Banner(SurfaceComponent message) A message from UIMessage laid across the top of the content: edge to edge, square, a rule under it, its mark in line with the header's name. Make it the content's first child, outside any padding of the content's own; it scrolls with the page. In the header region of a view with StickyHeader it stays as the page scrolls — on a phone it stands beside the drawer toggle there, and a tall one takes the screen from the page.
protected override IVisualComponent? CreateHeader()
    => UIPage.Header("Projects", "Everything the team is building.", new ThemeSwitcherComponent());

A page reached from another leads its header with Back. NavigateBackEffect is the browser's own Back where a page of this site stands behind, and its fallback address where none does — a bookmark, a link from elsewhere; it runs in the press, with no round trip (interactions and effects). Where back means a place of the application's — the tree a note was opened from — give the button a command instead.

protected override IVisualComponent? CreateHeader()
    => UIPage.BoundHeader(
        UIIconButtons.Back().InteractOn(EventNames.Click, new NavigateBackEffect("/notes")),
        nameof(NoteController.Name),
        nameof(NoteController.Status),
        UIIconButtons.Delete().OnClick(nameof(NoteController.Delete))
    );

A pane's row is the same call at UIHeaderSize.Pane:

UIPage.BoundHeader(
    UIHeaderSize.Pane,
    UIIconButtons.Back().ShownBelow(UIResponsiveTier.Md).OnClick(nameof(NotesController.BackToTree)),
    nameof(NotesController.NoteName),
    nameof(NotesController.Status),
    UIIconButtons.Share().OnClick(nameof(NotesController.Share)),
    UIIconButtons.Save().OnClick(nameof(NotesController.Save))
)

UICard — a card, and one alone on a page

Preset Builds
Create(UIPhrase? title, UIPhrase? description, IVisualComponent content, string? icon = null, params IVisualComponent[] trailing), BoundCreate(string titlePath, string? descriptionPath, [UIBindingScope scope,] IVisualComponent content, string? icon = null, params IVisualComponent[] trailing) A CardComponent with its name (and optional line and icon) in the default header, one component as its content, and trailing — an icon button, a switcher — at the header's far end (several stand in a row 4 px apart), the last one's glyph or quiet words on the card's edge as every band's end. The line is prose and wraps, however long; the name keeps one line. A null title leaves the name to the header: .ConfigureDefaultHeader(header => header.BindTitle(path)).
Centered(IVisualComponent card) One card alone on an otherwise empty page — a sign-in, a refusal, an outcome, or a stack of a form and what replaces it: a form's column (440 px, the whole width on a phone) in the middle, 24 px under the top on a phone and 96 px from the medium breakpoint, where a card at a wide screen's top edge reads as pushed up.
protected override IVisualComponent CreateContent()
    => UICard.Centered(UILayout.Stack(16, CreateForm(), CreateDone()));

private static SurfaceComponent CreateDone()
    => UIPage.BoundOutcome(
        AppIcons.MailCheck,
        UIColorStyle.Success,
        nameof(SignUpController.DoneTitle),
        nameof(SignUpController.DoneLine),
        UIButtons.Ghost("Start over").OnClick(nameof(SignUpController.StartOver)),
        UIButtons.Primary("Open the inbox").OnClick(nameof(SignUpController.OpenInbox))
    )
    .BindVisibility(nameof(SignUpController.DoneVisibility));

UIMessage — a message that stays in the page

A toast leaves on its own and a validation line belongs to one field; a message the page keeps until it is no longer true — "Your trial ends in 3 days", "This workspace is read-only during maintenance", "2 errors in the form below" — is a UIMessage. It returns a SurfaceComponent drawn Tinted in the palette's colour for its tone, holding the tone's mark, a title, a body, an optional action and an optional ×.

Preset Builds
Info, Success, Warning, Danger (UIPhrase? title, UIPhrase? description = null, ButtonComponent? action = null, bool dismissible = false, string? dismissCommand = null) A message in that tone. A title, a body or both: a message with neither throws.
Create(UIColorStyle tone, UIPhrase? title, UIPhrase? description, ButtonComponent? action = null, bool dismissible = false, string? icon = null, string? dismissCommand = null) The same with the tone as an argument, and icon in place of the tone's mark.
BoundCreate(UIColorStyle tone, string? titlePath, string? descriptionPath, UIBindingScope scope = Root, …) The words the controller holds, for words that change: bound as its own words and drawn plain — data, never markup (a path holding a UIPhrase still translates) — in the message's role and ink.
Create(UIColorStyle tone, TextComponent? title, ParagraphComponent? description, …) A title or a body of your own beyond words alone — a body with a link or an emphasis; the preset gives it the message's role and ink.
Tone (UIColorStyle) Mark To a screen reader
Info UIGlyphs.Info role="status": read when it is free
Success UIGlyphs.CheckCircle role="status"
Warning UIGlyphs.Warning role="alert": read at once
Danger UIGlyphs.Error role="alert"

The tone is one of those four members of the scale a badge's colour takes: any other (Primary, Accent, …) throws ArgumentOutOfRangeException, in a message, UIPage.Outcome and UIPage.Status alike.

  • The marks are the framework's own glyphs, drawn with no icon pack installed; icon takes any pack's name instead.
  • The role is the surface's LiveRegion (UILiveRegion.Status or Alert), so a message shown later — its Visibility bound — is read out as it appears, and a bound title or body as it changes. SetLiveRegion(null) on the result takes the role off a message that should only be read where the reader reaches it.
  • The action is your button, with its own command (UISize.Small unless you set a Size of your own). From the medium breakpoint it stands on the row's middle beside the words and the ×; on a phone it drops under the words. An outlined one (UIButtons.Outline) reads on every tint.
  • The × stands on the row's middle, its glyph on the message's far edge as the mark stands on the near one.
  • The × hides the message in the browser through one interaction from its click to the message's Visibility — nothing is sent, so a reload shows it again. The keyboard's focus goes on to the next control after the message, so a screen reader keeps its place. Its name is the framework's word "Dismiss" (ui.message.dismiss, shipped in Russian and Chinese). A message the server should stop showing for good takes a dismissCommand: the × still hides it at once, and runs the command beside the hide, where the controller records the choice and keeps its bound Visibility collapsed.
  • The title is in the subtitle role and the body in the body role, both in the page's own ink, which reads 4.5:1 on every tone's tint in both themes, the mark 3:1 or more.
UIMessage.Warning("Your trial ends in 3 days", "Billing starts on the 14th.",
    UIButtons.Outline("Upgrade").OnClick(nameof(BillingController.Upgrade)),
    dismissible: true)

A verdict the server gives, read out as it arrives:

UIMessage.BoundCreate(UIColorStyle.Success, null, nameof(CheckoutController.PromoVerdict))
    .BindVisibility(nameof(CheckoutController.PromoAppliedVisibility))

UIDialogs — a dialog with a header, a form, and a confirmation

A dialog headed by its mark, its title and an × at the far end, over its content.

Preset Builds
Create(string key, UIPhrase title, IVisualComponent content, string? icon = null, UIColumnWidth? width = null, params IVisualComponent[] trailing) A UIDialog named by its title, the header over the content; a width keeps the content to that column from the medium breakpoint (Wide, more than a tablet holds, from the extra-large one), the screen's width below, and trailing stands in the header before the ×. The rest keeps the dialog's defaults: change it with with { CloseOnBackdrop = false }, UIDialog being a record.
BoundCreate(string key, string titlePath, IVisualComponent content, string? icon = null, UIColumnWidth? width = null, params IVisualComponent[] trailing) The same with the title the controller holds — the thing's name, Add or Edit — bound as its own words (a path holding a UIPhrase still translates); it still names the dialog as it changes.
Fill(string key, UIPhrase title, IVisualComponent content, string? icon = null, UIColumnWidth? width = null, params IVisualComponent[] trailing), BoundFill(string key, string titlePath, …) A full-height UIDialog (Height = UILayoutLength.Fill(), and Width = UILayoutLength.Fill() unless width caps it to a UIColumnWidth) for content that fills and scrolls itself — a CodeInputComponent, TextAreaComponent, TableComponent, DataGridComponent or Graph canvas — placing the header in an Auto row and content directly in a Star(1) row with no outer ScrollContainerComponent.
Content(…), BoundContent(…) The header over the content, for a dialog laid out or set otherwise — a sheet, a height: new UIDialog { Key = key, TitleId = UIDialogs.TitleId(key), Content = UIDialogs.Content(key, title, body), … }.
Header(string key, UIPhrase title, string? icon = null, params IVisualComponent[] trailing), BoundHeader(string key, string titlePath, string? icon = null, params IVisualComponent[] trailing) The header alone: the title in the title role with the mark as its own icon, trailing before the ×, and the × at the far end, its glyph on the content's edge. The title carries UIDialogs.TitleId(key), which a dialog built around it names itself by.
CloseButton(string key, UIStandardAction? action = null, UIButtonVariant variant = Ghost) The dialog's own answer that closes it as the viewer does — Cancel, or Close or Done — in the framework's words: the held edits of the dialog's form go back, then the dialog closes on the page and raises its OnClose.
  • A dialog is named by the title it shows (UIDialog.TitleId, aria-labelledby), so a bound title names it as it changes; AccessibleName names a dialog with no title of its own. The view does not compile where TitleId names nothing inside the dialog's content, or a component in a template. A dialog stands at the view's root, never in a row, so its Bound* twins bind the controller's paths and take no UIBindingScope.
  • The × closes the dialog as Escape does: on the page, through interactions alone (DiscardFormEffect then CloseDialogEffect with RaisesClose), raising the dialog's OnClose, so a controller that cancels on Escape cancels on the × too. It is UIIconButtons.Close(), named by the standard action's word "Close" (ui.action.close, shipped in Russian and Chinese).
UIDialogs.Create("edit", "Edit message", UILayout.Stack(12, field, UIButtons.Pair(UIDialogs.CloseButton("edit"), save)), AppIcons.Edit, UIColumnWidth.Form)
    .OnClose(nameof(ChatController.CloseEdit))

A form

Preset Builds
Form(string key, UIPhrase title, UIPhrase? description, IVisualComponent content, ButtonComponent primary) A form in a dialog — rename it, invite someone, change a password: the title in the title role and an optional muted line under it, the content, and the standard Cancel (CloseButton) and primary at its foot, 16 px apart. No ×, since Cancel says it; a press on the backdrop loses nothing typed (CloseOnBackdrop is off), Escape closes it. A form's column wide (UIColumnWidth.Form, 440 px) from the medium breakpoint, the dialog's whole width on a phone.
Form(…, ButtonComponent safe, ButtonComponent primary) The same with a safe answer of your own in Cancel's place.
BoundForm(string key, string titlePath, string? descriptionPath, IVisualComponent content, [ButtonComponent safe,] ButtonComponent primary) The title and the line the controller holds — "Add a phrase" or "Edit the phrase", the folder an import goes into — as its own words, the line drawn plain; a title that stays the same is a key the controller holds (a path holding a UIPhrase still translates).
  • The dialog is a form, its key the form's id. Every field of the content with no FormId of its own, written or bound, is given the key, and the primary submits it (its SubmitFormId, unless it already submits another form) — so give the primary its command with OnClick or OnClickShowingLoading. What that does: Enter in a one-line field (one with no OnEnter) commits it and presses the primary; the primary's press judges the fields' Submit rules first and stops on any error, its focus on the first field in error; it waits for the fields' uploads; a field bound OnSubmit holds its value until the press and sends it then, while a field bound two-way still writes as it changes; the fields join one browser form, as a password manager reads them. Cancel puts the held values back and clears what the rules said, so the form opens again untouched.

A confirmation

The question asked before something is done — "Delete this note?" — is the other kind of dialog: no header and no ×, only its question, its words and its answers.

Preset Builds
Confirm(string key, UIPhrase question, UIPhrase? description, UIPhrase confirmTitle, string confirmCommand, UIButtonVariant confirmVariant = Danger, string? cancelCommand = null, ButtonComponent? middle = null) A UIDialog named by its question: the question in the subtitle role, wrapping; its words a body line 8 px under it; 16 px under those, Cancel, middle where given, and the committing button, pushed to the far edge (UIButtons.Pair). Confirm(key, question, confirmTitle, confirmCommand, …) asks the question alone.
Confirm(string key, UIPhrase question, ParagraphComponent? description, …) The same with words of your own beyond words alone — a link to what goes, an emphasis — given the body role and the page's ink.
BoundConfirm(string key, UIPhrase question, string descriptionPath, …) The words the controller holds at descriptionPath under a written question — "Delete «Groceries» and its 12 notes?" — kept as written (AsContent) and drawn plain: a name in them is the thing's own, never a key that happens to match it, nor markup; a path holding a UIPhrase still translates.
  • Cancel is UIDialogs.CloseButton(key): the standard action's word "Cancel" (ui.action.cancel, shipped in Russian and Chinese), a ghost button and the first, where the focus lands as the dialog opens. It closes the dialog on the page as the viewer's close (CloseDialogEffect with RaisesClose) and raises its OnClose, which runs cancelCommand where one is given.
  • Escape is Cancel: it closes the dialog and raises the same OnClose, so a controller hears both alike. A press on the backdrop is no answer and leaves the dialog open (CloseOnBackdrop is off).
  • The committing button is a primary or a danger one (confirmVariant; any other variant throws) in the words given, running confirmCommand. The command closes the dialog itself — CloseDialogEffect(key) among its effects — so a refused one leaves the question standing.
  • A middle answer is your button — "Don't save" for unsaved work — standing between Cancel and the committing one; an outlined one (UIButtons.Outline) reads as the other way.
  • The measures are the framework's own leave dialog's, so an application's question and the framework's read alike.
protected override IReadOnlyList<UIDialog> CreateDialogs()
    => [
        UIDialogs.BoundConfirm(
            "delete-note",
            "Delete this note?",
            nameof(NotesController.DeleteQuestion),
            "Delete",
            nameof(NotesController.DeleteNote)
        ),
        UIDialogs.Confirm(
            "unsaved",
            "Save your changes?",
            "They are lost if you leave without saving.",
            "Save",
            nameof(NotesController.SaveAndLeave),
            UIButtonVariant.Primary,
            cancelCommand: nameof(NotesController.Stay),
            middle: UIButtons.Outline("Don't save").OnClick(nameof(NotesController.DiscardAndLeave))
        )
    ];

UIMenuItems and UIIconButtons — the standard actions

The actions screens share, one name and one glyph each, so one screen's "Delete" reads as another's. Prefer these to an entry or an icon button written by hand.

Action Menu entry Icon button Glyph Name (ui.action.*)
Pin UIMenuItems.Pin(id = "pin") UIIconButtons.Pin() UIGlyphs.PinOutlined Pin
Unpin Unpin Unpin UIGlyphs.PinOff Unpin
Open Open Open UIGlyphs.OpenInNew Open
Edit Edit Edit UIGlyphs.Edit Edit
Copy Copy Copy UIGlyphs.Copy Copy
Duplicate Duplicate Duplicate UIGlyphs.Copy Duplicate
Save Save Save UIGlyphs.Save Save
Done Done Done UIGlyphs.Check Done
Cancel Cancel Cancel UIGlyphs.Close Cancel
Close Close Close UIGlyphs.Close Close
Back Back Back UIGlyphs.ArrowBack Back
New New New UIGlyphs.Add New
Delete Delete Delete UIGlyphs.Delete, in the danger colour Delete
More More(items, id = "more"), a submenu; More(id) its entries added later More(items), a ⋮ menu button; More().BindItems(path) for the controller's UIGlyphs.MoreVertical More
Refresh Refresh Refresh UIGlyphs.Refresh Refresh
Search Search Search UIGlyphs.Search Search
Filter Filter Filter UIGlyphs.Filter Filter
Settings Settings Settings UIGlyphs.Settings Settings
Share Share Share UIGlyphs.Share Share
Download Download Download UIGlyphs.Download Download
Upload Upload Upload UIGlyphs.Upload Upload
Rename Rename Rename UIGlyphs.Rename Rename
Add Add Add UIGlyphs.Add Add
Remove Remove Remove UIGlyphs.Remove Remove
Send Send Send UIGlyphs.Send Send
Attach Attach Attach UIGlyphs.AttachFile Attach
Menu Menu Menu UIGlyphs.Menu Menu
Stop Stop Stop UIGlyphs.Stop Stop
Undo Undo Undo UIGlyphs.Undo Undo
Redo Redo Redo UIGlyphs.Redo Redo
Sign out SignOut SignOut UIGlyphs.Logout Sign out
  • Save writes a document out; Done ends an edit made in place — a message's words edited where they stand, a cell, a title — with a check beside Cancel's ×. Back leads a page's header (UIPage.Header(leading, …)) with a NavigateBackEffect or a command of its own; New makes one more of what a list or a chooser holds, where Add puts an existing one in it (both the plus); Remove takes one out of a list and keeps it, where Delete destroys it. More is the ⋮ that holds the rest: a menu button with no chevron (a SplitButtonComponent), its entries the standard ones where they fit.

  • A menu entry is a MenuItem whose id is the action's name unless given (UIMenuItems.Delete("delete-file")): the id the menu's click reports. Set anything else on it as on any entry (InActionBar, Items).

  • An icon button is a ghost ButtonComponent whose tooltip is its name; give it its command with OnClick.

  • A command bar's or a button group's item is UIStandardAction.Delete.ToButtonItem(id, variant, iconOnly) (the core): its glyph, its words on the button or as its tooltip, and its danger as these buttons draw it — a filled one's fill, a bare one's ink.

  • The names are the framework's words, shipped in Russian and Chinese. They come from UIStandardAction (the core), which the built-in tab menu and a key-value row's buttons take too, so renaming ui.action.delete renames every "Delete".

  • The glyphs are the framework's own, mostly filled. An application drawing its icons outlined maps them onto its pack once at startup — services.MapUIGlyph(UIGlyphs.Copy, MaterialIcons.Outlined(MaterialIcons.ContentCopy)) — and every entry, button and built-in that wears the glyph follows (web hosting).

menu.SetItems([UIMenuItems.Edit(), UIMenuItems.Copy(), UIMenuItems.Delete()]);
UILayout.Row(4, UIIconButtons.Edit().OnClick(nameof(NotesController.Edit)), UIIconButtons.Delete().OnClick(nameof(NotesController.Delete)))
UIIconButtons.More([UIMenuItems.Rename(), UIMenuItems.Share(), UIMenuItems.Delete()]).OnItemClickWithItemKey(nameof(NotesController.Run))

UIText.WithBadges — a title over its badges

A title with a row of badges under it in place of a description — a release's environment and replicas, a contact's labels — and an optional mark before both, centred across the two lines. The badges wrap onto further lines.

Preset Builds
WithBadges(UIPhrase title, IEnumerable<BadgeItem> badges, string? icon = null) The title in the body's role over one BadgeComponent per BadgeItem: its variant, colour, fill, icon, text and tooltip.
BoundWithBadges(string titlePath, string badgesPath, UIBindingScope scope = Root, string? icon = null) The title the controller holds — in a list's row — as content, over the collection of BadgeItems at badgesPath, kept in step as it changes.
UIText.WithBadges("billing · #481", [
    new BadgeItem { BadgeTitle = "production", BadgeVariant = UIBadgeVariant.Success },
    new BadgeItem { BadgeTitle = "8 of 8", BadgeIcon = AppIcons.Check }
], AppIcons.Server)

UIText.Quote — a quote

A quote as a messenger draws a reply or an edit: a 3 px stroke at its start in an accent colour, a title as a caption in that colour — who wrote it, or "Editing" — and one muted line under it, the start of the words, cut with an ellipsis. It returns a SurfaceComponent with no fill of its own, so it stands on whatever holds it, a message's tint included.

Preset Builds
Quote(UIPhrase title, UIPhrase description, UIThemeColor? accent = null, string? clickCommand = null, string? closeCommand = null) A quote in accent, or in the brand (UIThemeColor.Primary) where none is given.
BoundQuote(string titlePath, string descriptionPath, UIBindingScope scope = Root, string? accentPath = null, string? clickCommand = null, string? closeCommand = null) The same bound to what the controller holds — a reply line over a composer, a quote in a message's row — its colour at accentPath where one is given, the brand while that is null.
Quote(IVisualComponent content, UIThemeColor? accent = null, string? clickCommand = null, string? closeCommand = null) The same stroke round content of your own — a paragraph, a picture and its caption, a whole message — in accent, or in the neutral border colour a quotation inside text is drawn in (UIThemeColor.Border) where none is given; pressable and closed as the others.
  • The title and the line are content: a person's name and words are shown as written, never looked up as a key. A UIPhrase.Of(key) — "Editing" in the reader's language — is still translated.
  • clickCommand makes the whole quote pressable, by the keyboard too, with a press's wash — a jump to the message it quotes. A jump that names what it quotes takes its argument on the result instead: .OnClick(command, arguments).
  • closeCommand ends the quote in an × — UIIconButtons.Close(), named "Close" (ui.action.close) — for the reply line the reader can drop, its glyph on the quote's end as every band's end icon. A press on the × is the ×'s alone, never the quote's; it hides the quote at once and runs the command beside the hide, as a message's × does.
  • The stroke is as wide as a Markdown display's blockquote (the CodeInput package), so a quote in a message and the reply over it are drawn alike.
// Over the composer: who is answered, the start of their words, and an × that drops the reply.
UIText.BoundQuote(nameof(ChatController.ReplyTitle), nameof(ChatController.ReplyLine), closeCommand: nameof(ChatController.CancelReply))
    .BindVisibility(nameof(ChatController.ReplyVisibility))

// Inside a message's row: in its author's colour, pressed to go to the message it quotes.
UIText.BoundQuote(nameof(MessageItem.ReplyAuthor), nameof(MessageItem.ReplyLine), UIBindingScope.Relative, nameof(MessageItem.ReplyAccent))
    .OnClick(nameof(ChatController.JumpToAsync), UIAction.ArgRelative("id", nameof(MessageItem.ReplyId)))

UIText.Person — a person

Preset Builds
Person(string? avatar, UIPhrase name, UIPhrase? description = null, UISize size = Medium) A person as a list's row or a byline shows one: the round picture (the person glyph where avatar is null or fails), and 12 px after it, on its middle, the name in the body's role over a muted caption — a role, how long ago, the last words. Both are content, a person's own words as written; a UIPhrase.Of key still translates. The picture has no words of its own for a screen reader: the name stands beside it.
Person(string? avatar, IVisualComponent words, UISize size = Medium) The same beside words of your own — a name with a badge, a line with a timestamp — standing where the name would.
BoundPerson(string? avatarPath, string namePath, string? descriptionPath = null, UIBindingScope scope = Root, UISize size = Medium) The same bound to what the controller holds — a chat's row (UIBindingScope.Relative), the person a conversation is with — the person glyph where no avatar path is given or it holds nothing.

Three sizes of the one UISize, never one a page picks: Small (32 px — a dense row, a menu, a table's cell), Medium (40 px — a list's row, a byline) and Large (48 px — a profile's head, a conversation's header). A pane's title row with a person in it is UIPage.Header(UIHeaderSize.Pane, …) with the round picture as its leading.

.SetTemplate(UILayout.Ends(
    UIText.BoundPerson(nameof(ChatItem.Avatar), nameof(ChatItem.Title), nameof(ChatItem.LastWords), UIBindingScope.Relative),
    new TimestampComponent().BindValue(nameof(ChatItem.At), UIBindingScope.Relative).SetFormat(UITimestampFormat.Relative)
))

UIForm — the parts of a form besides its fields

Preset Builds
Field(IVisualComponent input, UIPhrase? hint = null), Field(IVisualComponent input, ParagraphComponent hint), BoundField(IVisualComponent input, string hintPath, UIBindingScope scope = Root) The input with a muted, wrapping hint under it: what may be typed, what it is for — or the input alone in the same column, so a form writes every field one way; a paragraph of your own (inline links) or the line the controller holds (how much is left), as content. The hint starts where the field's words do — under a switch or a checkbox, with its label's words past the box, never under the box's edge.
Row(params IVisualComponent[] fields), Row(double spacing, params IVisualComponent[] fields) Fields side by side in equal columns — a city and its postcode, a first and a last name — their tops level, so a field that grows a validation line does not move its neighbour; 16 pixels apart unless spacing says otherwise. Among fields with a caption over their boxes, a control with none — a switch, a checkbox, a button — stands a caption line down, centred on a box of their size, while they stand side by side; with its hint (Field) the control stands on the box and the hint under it. A thing under its label (UIPage.Labelled), or a row or a grid holding a titled field (a field and its Add), counts as captioned.
Composer(TextAreaComponent textArea, params IVisualComponent[] banners), Composer(TextAreaComponent textArea, FileInputComponent? attachments, params IVisualComponent[] banners) A messenger's or comment box's composer panel: a calm borderless SurfaceComponent (WindowFoot = true), an optional Shelf FileInputComponent accepting drops across the panel and sharing FormId with the text area, any reply or edit quote banners above the field, and a ghost TextAreaComponent that grows up to six rows with its actions kept on one row beside the text by default (on a phone with many tools, either fold secondary tools into a UIIconButtons.More() ⋯ menu button or call SetActionsBelow(UIResponsiveTier.Md) without inField so the text takes the upper row and all buttons including Send stand on a row below it without a dividing hairline).
UIForm.Field(new TextAreaComponent()
    .SetTitle("Invoice note")
    .SetMaxLength(200)
    .BindValue(nameof(CheckoutController.InvoiceNote)),
    "Printed on every invoice, two hundred characters at most.")

Row divides the twenty-four columns of the placement grid evenly, so it takes two, three, four or six fields and throws for any other count. It is UILayout.Columns(spacing, UIAlignment.Start, fields) underneath, so on a narrow screen the fields stand one under another, as below. A row of fields is UIForm.Row rather than UILayout.Columns, which centres a field against a taller neighbour. A control with no caption stands a caption line down, centred on the fields' box, from the width the cells stand side by side at (md, xl for four or six), at the captioned fields' Size — medium where they differ; stacked, it stays where it is. That is not the row's doing: wherever a control with no caption — a button, an untitled field, a switch, a button group, a panel of them — stands beside a field that is captioned itself, in a horizontal stack of your own that does not wrap or on a grid's row, the framework stands it level with the box, per width as the arrangement turns (AlignWithFieldBoxes, which the compiler sets where you leave it unset). A card, a list or words alone stay put, as does anything beside a whole column of fields or in a wrapping panel of your own, whose later line has no field beside it. UILayout.Row asks for it itself: a thing with no caption stands in a cell whose padding takes the caption's line, on every line, a wrapped one too. A panel takes it as its top padding and least height, anything else as its top margin; with an authored Padding or Margin nothing is implied, and UIFieldBoxAlignment.None keeps a thing where it is laid out:

new StackPanelComponent()
    .SetOrientation(UIOrientation.Vertical, md: UIOrientation.Horizontal)
    .AddChild(new TextInputComponent().SetTitle("City"))
    .AddChild(new ButtonComponent().SetTitle("Find"))

Two more of a panel's own say where what it holds stands beside buttons, both drawn by the stylesheet from its tokens and the theme's lines, never a number of yours: GlyphEdge (UIAlignment.Start or End) hangs the first or last quiet button past the panel's edge, so its glyph or its words stand on the content's edge (an icon by its own IconSize), FirstLineOnControl(UISize) sets its first child down so that child's first line stands on a button's middle — a name that wraps beside the buttons at its row's end, as a page header's does on a phone — and FirstChildAsCaption stands its first child in a field's caption row, so a label over a control (UIPage.Labelled) stands the control level with captioned fields' boxes.

UILayout — the arrangements

Preset Builds
Stack(double spacing = 12, params IVisualComponent[] children) Children down a column with the same spacing between each pair.
Row(double spacing = 8, params IVisualComponent[] children) Children along a row, wrapping onto the next line when the row is too narrow. Beside a field with a caption over its box, a thing with none — a button, a field without a title — stands level with the box at every width, as in UIForm.Row (the filters in a UIPage.Band).
Columns(double spacing = 16, params IVisualComponent[] children) Children in equal columns — two, three, four or six of them; any other count throws.
Columns(double spacing, UIAlignment? cellAlignment, params IVisualComponent[] children) The same, every cell standing at cellAlignment — UIAlignment.Start holds the cells by the top, as UIForm.Row does; null lets each cell take its child's own.
Split(IVisualComponent main, IVisualComponent side, int sideSpan = 8, double spacing = 24) A main part with a side part to its right, the side taking sideSpan of the twenty-four columns.
Sidebar(IVisualComponent side, IVisualComponent main, int sideSpan = 8, double spacing = 24) The other way round: the side part first (a list, a tree, a filter rail), the main part beside it.
Ends(IVisualComponent start, params IVisualComponent[] end) Something at the start of a row and things at its far end — a title and its buttons, a line and its action, a search and its Add: the end as wide as it is (an Auto column), never half the row, the start the rest, both on the row's middle, 12 px apart and the end's things 8 px apart (4 px when every trailing control is an icon-only button, as in UIPage.Header). Beside a start with a caption over its box — a titled select and its New and Copy — the end stands level with the box, as UIForm.Row stands a control with no caption. On a phone buttons with words stand under the start at the far end, as a page header's do; icons and the rest keep the row. An icon or quiet words at either end stand their glyph on the row's edge, so rows under an Ends row that end in icons are Ends rows too, or a hand-built grid's icons stand inside the edge the Ends row's hang on.
Board(IVisualComponent[] start, IVisualComponent[] end, double spacing = 16) Cards on two columns, each a stack read top to bottom — a settings page's panels, an account's — held by their tops, spacing apart down a column and across; below xl the columns stand one under the other, the start's first. Either column empty throws.
Panes(IVisualComponent list, IVisualComponent detail, string statePath, IVisualComponent? placeholder = null, bool splitter = false) A list and the thing chosen in it — chats and a conversation, a tree and a note, mail and a message: side by side from md, the list 280 px wide and 16 px of air; with splitter a GridSplitterComponent between them, the list from 200 to 480 px. The controller's UIPanesState at statePath says which shows. Below md one at a time, in one cell: the detail in the list's place once it is in front. A placeholder (UIPage.Empty) stands in the detail's place while nothing is chosen.

Each of Columns, Split and Sidebar stands its parts one under another on a narrow screen: two or three columns go side by side from the md tier, four or six columns, a split and a sidebar from xl. Side by side, a part keeps its own VerticalAlignment against a taller neighbour — a text, an input or a button is centred by default — and one that must stay at the top says SetVerticalAlignment(UIAlignment.Start).

Panes leaves which pane shows to the controller, which holds a UIPanesState and moves it: ShowDetail() brings the chosen thing to the front, ShowList() goes back to the list with the chosen thing still beside it from md, ShowNothing() goes back with nothing chosen, the placeholder beside. A state starts with the list in front and nothing chosen — new(chosen: true) for panes with no placeholder, whose detail always stands beside. Its Share is the splitter's: seed what the person kept with SeedShare, and ShareChanged says when they moved it. UILayout.PanesListVisibility, PanesDetailVisibility and PanesPlaceholderVisibility are the values the state holds, for a part of the page that follows a pane, and band.InPanesList() gives a band over the list (its header in the header region) the list's width from md, its own padding outside — without a splitter, since a list the reader widens is wider than any band can know. The detail brings its own way back, shown on a phone only:

// View
UILayout.Panes(
    CreateChats(),
    CreateConversation(),
    nameof(ChatController.Panes),
    UIPage.Empty(AppIcons.Chat, "Pick a chat", "The conversation opens here."),
    splitter: true
)
.SetHeight(UILayoutLength.Fill())

UIPage.BoundHeader(UIHeaderSize.Pane, UIIconButtons.Back().OnClick(nameof(ChatController.Back)).ShownBelow(UIResponsiveTier.Md), nameof(ChatController.Partner))

// Controller
[RecursiveMember]
public partial UIPanesState Panes { get; set; } = new();

// Opening a chat, and its Back
Panes.ShowDetail();
Panes.ShowNothing();

// The division the person keeps: stored when they move it, subscribed once (the constructor)…
Panes.ShareChanged += (_, _) => Context.Runtime.Post(token => Accounts.SetChatSplitAsync(AccountId, Panes.Share, token));

// …and read on every show
Panes.SeedShare(account.ChatSplit);

The spacing comes first, so a stack with children always names it:

UILayout.Sidebar(CreateFilters(), UILayout.Stack(16,
    UIText.Title("Results"),
    CreateResults()
), sideSpan: 6)

UIButtons — a button in its type, and the rows buttons go in

Preset Builds
Primary, Accent, Outline, Ghost, Danger, Link (UIPhrase title, string? icon = null) A ButtonComponent of that type; the words a key with its arguments where they need them (UIPhrase.Of("cart.pay", ("total", total))).
Primary, Accent, Outline, Ghost, Danger, Link (UIStandardAction action, bool glyph = false) The button naming a standard action in the framework's words — Save, Copy, Done — its glyph before them where glyph. Delete fills in the danger colour on a filled type and takes the danger ink on a bare one. A dialog's own Cancel is UIDialogs.CloseButton.
Icon(string icon, UIPhrase tooltip) An icon-only ghost button; the tooltip is its only name, so it is required. A glyph and a name the controller holds — Send that turns into Stop while a reply is written — are bound on the button it returns, Icon(send, word).BindIcon(path).BindTooltip(path), the written ones the bindings' fallback while the paths hold nothing.
Pair(ButtonComponent safe, ButtonComponent primary) The pair at a form's foot: the safe answer first, the committing one last, both pushed to the far edge.
Toolbar(params IButtonComponent[] buttons) A row of buttons with a toolbar's tight spacing, from the near edge, the first one's glyph or quiet words on it — under a message, over an editor — its box hanging past it into the padding.
UIButtons.Pair(
    UIButtons.Ghost("Keep it"),
    UIButtons.Danger("Delete project").OnClick(nameof(ProjectController.DeleteAsync))
)

UIButtons.Toolbar(
    UIButtons.Icon(MaterialIcons.Undo, "Undo"),
    UIButtons.Icon(MaterialIcons.Delete, "Delete")
)

(MaterialIcons comes from the icon package; any icon name works.)

UIText — a line in its role

Display, Title, Subtitle, Body and Caption take (UIPhrase? title = null, UIPhrase? description = null) and return a TextComponent in that role. Label(UIPhrase? label = null) is the muted overline a thing is labelled by. Paragraph(UIPhrase? text = null) is prose that wraps, and Note(UIPhrase? text = null) a muted caption that wraps — the line under a heading that explains rather than names; both return a ParagraphComponent. Words left out are bound after — UIText.Note().BindDescription(path) — and blank words are refused: null is the one spelling of "none written". A heading keeps one line and ends in an ellipsis, and so does its description: a TextComponent is a label, so SetWrapMode(UITextWrapMode.Wrap) lets its description run on and SetTitleWrap(true) its title — a heading in prose, an article's headline. A card's and an expander's default header wrap their description on their own.

The same roles exist as extension methods on any text component — a template's, one of your own: AsDisplay(), AsTitle(), AsSubtitle(), AsBody(), AsCaption(), AsOverline(), and Muted(), which puts both lines in the muted colour. UIText.Editable(titlePath, scope?, renameCommand?) and .Editable(titlePath, scope?, renameCommand?) on any TextComponent<T> (including a card's or an expander's ConfigureDefaultHeader(header => header.Editable(...))) turn a bound title into an inline-renamable one (SetRenamable + BindTitle + BindRenamedTitle, with an optional OnRename command) that opens an inline field of the same font and height on double-click, F2 when focused, or new RenameItemEffect(target).

UILayout.Stack(4,
    UIText.Title("Storage"),
    UIText.Caption().Muted().BindTitle(nameof(AccountController.StorageLine))
)

UIDetails — names and values to read

UIDetails.List(params (UIPhrase Key, UIPhrase Value)[] rows) is a KeyValueActionComponent without the action column or a border of its own — an order's summary, a record's facts — for a card or a surface to hold. Rows are keyed by name, so a list that repeats a name throws.

UIDetails.List(("Plan", "Standard"), ("Region", "Europe West"), ("Billed", "Monthly"))

For values that change, bind the items instead — the list is the component that holds them, so it has no bound twin — and build each row with UIDetails.Row(string id, UIPhrase key, UIPhrase? value), which returns a KeyValueActionItem whose key is in the muted colour:

// Controller
public RecursiveCollection<KeyValueActionItem> Lines { get; } =
[
    UIDetails.Row("plan", "Plan", string.Empty),
    UIDetails.Row("region", "Region", string.Empty)
];

// View
UIDetails.List().BindItems(nameof(CheckoutController.Lines))

The sums under a summary are a line each: UIDetails.Amount(UIPhrase label, string valuePath) — the name muted at the start, the amount the controller holds at the far end, as wide as it is, one line at every width — and UIDetails.Total(UIPhrase label, string valuePath), the line they come to, both in the subtitle role. BoundAmount and BoundTotal take the name's path too, for a rate that changes. The amount is content, shown as the controller holds it; each takes a UIBindingScope after its paths, for a row's own sums.

UILayout.Stack(12,
    UIDetails.Amount("Subtotal", nameof(CheckoutController.SubtotalLine)),
    UIDetails.Amount("VAT, 21%", nameof(CheckoutController.VatLine)),
    UIDetails.Total("Total a month", nameof(CheckoutController.TotalLine))
)

Shown on one side of a breakpoint

ShownBelow(UIResponsiveTier tier) shows any component below the tier and collapses it from there on — a Back that a phone needs and a desktop, with the list beside the pane, does not; a drawer's toggle — and ShownFrom(tier) is the other way round. Both set Visibility, so they replace a visibility set before them.

Shown, hidden, enabled or disabled by another component

ShownWhen, HiddenWhen, EnabledWhen and DisabledWhen extend any component and watch the value of another one, passed directly as a component instance (IBindableComponent / IVisualComponent) or by its string component id. Each is one Interact (see interactions and effects), so the rule runs in the browser without a round trip to the server.

Call Holds while
ShownWhen(source) / HiddenWhen(source) / EnabledWhen(source) / DisabledWhen(source) The source has a value: a switch on, a box ticked, a select with a choice.
...When(source, object? value) The source's Value equals value.
...When(source, UIProperty property, UIComparisonOperator @operator, object? value) The named property of the source satisfies the comparison.

ShownWhen and HiddenWhen collapse the component when it is not shown; EnabledWhen and DisabledWhen enable or disable it. The rule follows the reader's own edit of the source as well as a value the server pushes, so a switch turned on reveals its panel at once. It holds from the first paint too: a source the view sets (or leaves at its default) is read as the page is rendered, so a note under a switch that is off arrives hidden; a bound source's rule runs as the page takes its values. The server never sees the rule's state, and a property a rule writes closes nothing there: a Subscribe enabled by EnabledWhen(TermsId) takes a press from a page whose terms box is not ticked. The command checks what it needs (TermsAccepted) itself, or the gate is bound to the controller (BindEnabled), which the server reads.

UILayout.Stack(28,
    new RadioGroupComponent(BilledId)
        .SetTitle("Billed")
        .SetOptions(
        [
            new OptionItem { Id = "direct", Title = "Directly" },
            new OptionItem { Id = "reseller", Title = "Through a reseller" }
        ])
        .BindValue(nameof(SubscribeController.Billed)),
    UIPage.Section("Company address", null, CreateAddress())
        .HiddenWhen(BilledId, "reseller"),
    new CheckboxComponent(TermsId)
        .SetTitle("I accept the terms")
        .BindValue(nameof(SubscribeController.TermsAccepted)),
    UIButtons.Primary("Subscribe")
        .EnabledWhen(TermsId)
)