Skip to content
Client v5: BLE, BLE Hosting, HTTP, Jobs - Linux, MacOS, & Blazor Support! Full AOT, RX on BLE only & MANY other features! Power up!

Toolbar & TabBar | ShinyToolbar

ShinyToolbar docks to the top or bottom of its scroll container as an action bar — a leading title (or custom content), trailing icon actions with links/badges, and an automatic overflow menu for actions that don’t fit. It supports a frosted-glass look via CSS backdrop-filter.

@using Shiny.Blazor.Controls

No service registration is required — it’s a plain Razor component.

Frosted top toolbar — content scrolls under

Section titled “Frosted top toolbar — content scrolls under”

position: sticky reserves the bar’s height (content starts below it) and content slides under it as you scroll. With Frosted, the content blurs through the glass.

<div style="height: 320px; overflow-y: auto;">
<ShinyToolbar Dock="ToolbarDock.Top"
Frosted="true"
Title="Inbox"
Items="@items"
ItemClicked="OnItemClicked" />
<!-- tall scrollable content slides under the frosted header -->
@for (var i = 1; i <= 30; i++)
{
<p>Message @i</p>
}
</div>
@code {
List<ToolbarItem> items = new()
{
new() { Icon = "<svg viewBox='0 0 24 24'>…search…</svg>", Text = "Search" },
new() { Icon = "<svg viewBox='0 0 24 24'>…bell…</svg>", Text = "Alerts", Badge = "3" },
new() { Icon = "/icons/compose.png", Text = "Compose", Href = "/compose" }
};
void OnItemClicked(ToolbarItem item) { /* … */ }
}

When the trailing Items can’t all fit the available width, the ones that don’t are tucked into a dropdown menu behind an overflow (“more”) button. As the bar narrows, items collapse into the menu; as it widens they pop back out. This is on by default — you don’t build the “more” menu yourself.

<ShinyToolbar Dock="ToolbarDock.Top"
Title="Editor"
Items="@items"
MenuBackgroundColor="#1F2937"
MenuTextColor="#F9FAFB"
ItemClicked="OnItemClicked" />

Each menu entry mirrors its toolbar item — icon, Text label, and Badge — and raises the same ItemClicked callback (Href items render as links; IsDisabled items are dimmed). The menu closes on an outside click or after a selection.

Sizing is measured automatically: a tiny JS module (toolbar.js, shipped with the package and auto-imported) uses a ResizeObserver to measure each item’s intrinsic width and reports back how many fit, reserving room for the overflow button at the boundary.

Customize the affordance with OverflowIcon (inline SVG/HTML — defaults to a hamburger glyph), OverflowText (label under the button when ShowItemLabels is on, default "More"), OverflowAriaLabel (accessible name), and the dropdown’s MenuBackgroundColor / MenuTextColor.

<ShinyToolbar Dock="ToolbarDock.Top"
BackgroundColor="#7C3AED"
TextColor="#FFFFFF"
Title="Dashboard"
Items="@items" />

Use StartContent, ChildContent (center), and EndContent for fully custom layouts instead of Title + Items.

<ShinyToolbar Dock="ToolbarDock.Top" BackgroundColor="#0F172A" TextColor="#E2E8F0">
<StartContent>
<button @onclick="GoBack">&#x2190;</button>
<strong>Project Atlas</strong>
</StartContent>
<EndContent>
<Pill Text="Live" PillColor="#10B981" />
</EndContent>
</ShinyToolbar>
<ShinyToolbar Dock="ToolbarDock.Bottom"
ShowItemLabels="true"
Items="@actions"
ItemClicked="OnItemClicked" />
PropertyTypeDefaultDescription
DockToolbarDockTopDocks to the Top or Bottom edge
Stickybooltrueposition:sticky (content scrolls under); set false for a normal in-flow bar
Titlestring?nullConvenience leading title text (used when StartContent is not set)
ItemsList<ToolbarItem>?nullTrailing action/link items (used when EndContent is not set)
StartContentRenderFragment?nullCustom leading content
ChildContentRenderFragment?nullCustom center content
EndContentRenderFragment?nullCustom trailing content (disables overflow)
OverflowEnabledbooltrueCollapse trailing Items that don’t fit into a hamburger dropdown. Ignored when EndContent is set or Items is empty
OverflowIconstringhamburger SVGInline SVG/HTML for the overflow (“more”) button
OverflowTextstring?"More"Label shown beneath the overflow button when ShowItemLabels is on
OverflowAriaLabelstring"More actions"Accessible label for the overflow button
MenuBackgroundColorstring#FFFFFFOverflow dropdown background
MenuTextColorstring#1F2937Overflow dropdown foreground
BackgroundColorstring#FFFFFFSolid fill (ignored when Frosted)
TextColorstring#1F2937Foreground color
Heightdouble56Bar height (min-height) in pixels
IconSizedouble22Item icon size in pixels
ShowItemLabelsboolfalseShow each item’s Text beneath its icon
FrostedboolfalseFrosted glass via backdrop-filter
BlurRadiusdouble20Blur amount in pixels when Frosted
TintColorstringrgba(255,255,255,0.7)Translucent fill when Frosted
HasShadowbooltrueEdge shadow (direction follows Dock)
BorderColorstring?nullHairline color on the docked edge
BorderThicknessdouble0Hairline thickness in pixels
SafeAreabooltrueAdds env(safe-area-inset-*) padding on the docked edge
ZIndexint100Stacking order
CssClassstring?nullExtra root CSS class
Stylestring?nullExtra inline style appended to the root

Events: ItemClicked — fires the ToolbarItem that was tapped, whether from the bar or the overflow menu.

PropertyTypeDefaultDescription
Iconstring?nullInline SVG/HTML, a glyph/emoji, or an image URL
Textstring?nullLabel (shown when ShowItemLabels is true)
Hrefstring?nullWhen set, the item renders as a link to this URL
Targetstring?nullAnchor target (e.g. _blank); only used with Href
Badgestring?nullBadge text shown on the item (e.g. a count)
IconColorstring?nullOverrides the toolbar foreground for this item
IsDisabledboolfalseDims the item and blocks clicks
Tagobject?nullArbitrary payload returned via ItemClicked