Toolbar

ToolbarControl · ToolbarButtonControl · AppBarControl

Put a window's commands in one row, with a title bar above it.

Overview

ToolbarControl is a Blazor toolbar: a row of command buttons with separators, an area at the right, and a checkbox that hides the button captions. Use it above a document, list or form for the commands users reach for most: ToolbarButtonControl draws each button with an icon and a caption, and AppBarControl adds a title bar with start, middle and end areas that can stay in view while the content scrolls.

Examples

#Commands, captions and a trailing area

Work on the task: each button changes the card under the toolbar, and the task's cost sits in TrailingContent. Clear Captions to leave icons and tooltips; Share keeps its text because it is the button's ChildContent. Drop an hour stops at two hours, the smallest estimate the studio gives, and Web form shows where the request came from. Priority and Web form are Selected toggles; the library styles Selected only on Large buttons, so this page adds .tb ::deep .fx-toolbar-btn--selected { background: #eef2ff; border-color: #c7d2fe; }, with the same colors on hover and keyboard focus; Vertical buttons sets Vertical, and fx-toolbar--wrap drops the trailing block below the buttons on a narrow screen.

WEB-123 Photo gallery for Green Fork Cafe 3 hours · $285Saved

#Large tool tiles

Pick a label and its tasks appear: Large, Vertical buttons in a toolbar with the fx-toolbar--large-tools class and no Captions checkbox; Selected marks the chosen tile, which the library styles on Large buttons.

Design: WEB-101 Style guide, WEB-102 Logo refresh

#App bar over a toolbar

Scroll the frame: the app bar stays at the top while Position is Sticky. This toolbar keeps its own captions state, and Export shows the HasDropdown arrow; the menu under it is page markup, closed by a click anywhere outside it: its click-catcher sits above the site's top bar too.

Last action: none yet

QA notes, task WEB-123

Documentation

ParameterTypeDefaultDescription
ChildContentRenderFragment?nullThe items, in a row that wraps when there is not enough room.
TrailingContentRenderFragment?nullRight-hand area, after the Captions checkbox. It does not shrink or wrap.
ShowCaptionsbool?nullShows or hides the buttons' Label captions. Null lets the toolbar keep its own state, read from the preference service when there is one and true otherwise; a value wins over that state, so update it from ShowCaptionsChanged.
ShowCaptionsTogglebooltrueDraws the Captions checkbox at the right. Pass false on a toolbar whose items are not ToolbarButtonControls with labels, where the checkbox would hide nothing.
CaptionsToggleLabelstring"Captions"Text beside the checkbox.
PreferenceKeystring?nullName for storing the captions setting; Toolbar when blank, so toolbars without a key share one. FlexCore defines no storage or interface: declare and register an Fx.ControlKit.IUserPreferencesService with GetBool(string, string, bool) and PutBool(string, string, bool). The toolbar calls them by reflection with ("Toolbar", "key.Captions", …): a read at start when ShowCaptions is null, a write on every toggle. Without it the setting lasts as long as the component.
EffectiveShowCaptionsbool—Read-only. ShowCaptions when set, else the toolbar's own state.
Rolestring"toolbar"ARIA role of the root.
CssClassstringstring.EmptyAdded to fx-toolbar; see the classes below for fx-toolbar--wrap, fx-toolbar--scroll and fx-toolbar--large-tools.
(no base class)—It does not inherit FlexControlBase: there is no Id, Style or Visible, and any other attribute, such as id or aria-label, throws when the page renders. Wrap the toolbar in your own element to style or name it.

With captions off the root gets fx-toolbar--no-captions: Label captions are hidden, buttons shrink to 30px high and lie flat even when Vertical, and every ToolbarButtonControl shows its tooltip even with ShowTooltip false. Text passed as a button's ChildContent stays visible. A button with a Label and no icon is left empty, so give every button an icon.

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.