---
title: ToolbarBuilder
summary: API reference for ToolbarBuilder.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-09-17
library: SAIF.Framework.Web.Mvc
reference_type: package
---

# ToolbarBuilder

Fluent builder wrapping a `Toolbar`; its `Items(Action<ToolbarItemFactory>)` method is the sole way callers add items, invoking the caller's lambda with a factory bound to the toolbar.

## Purpose
- Fluent builder wrapping a `Toolbar`; its `Items(Action<ToolbarItemFactory>)` method is the sole way callers add items, invoking the caller's lambda with a factory bound to the toolbar.

## Context
- Namespace: `SAIF.Web.Mvc.UI`
- Assembly/package: `SAIF.Framework.Web.Mvc (source-shipping NuGet package)`
- Kind: class

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| ToolbarBuilder(Toolbar) | `public ToolbarBuilder(Toolbar component)` | Passes `component` to the `ViewComponentBuilderBase<Toolbar, ToolbarBuilder>` constructor, wrapping the given `Toolbar` for fluent configuration. |
| Items(Action&lt;ToolbarItemFactory&gt;) | `public ToolbarBuilder Items(Action<ToolbarItemFactory> addAction)` | Invokes the supplied lambda with a `ToolbarItemFactory` bound to this toolbar, allowing the caller to add items; see the "Build a toolbar through the fluent API" operation. |

## Inherited public members

Members in this section are inherited from `ViewComponentBuilderBase<TViewComponent, TBuilder>` in `SAIF.Framework.Web.Mvc`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| HtmlAttributes(object) | `public virtual ToolbarBuilder HtmlAttributes(object attributes)` | Converts the anonymous object to a dictionary and delegates to the `IDictionary<string, object>` overload. | `SAIF.Framework.Web.Mvc` — `ViewComponentBuilderBase<TViewComponent, TBuilder>` |
| HtmlAttributes(IDictionary&lt;string, object&gt;) | `public virtual ToolbarBuilder HtmlAttributes(IDictionary<string, object> attributes)` | Clears the wrapped `Toolbar`'s `HtmlAttributes` and merges in the supplied dictionary, then returns the builder. | `SAIF.Framework.Web.Mvc` — `ViewComponentBuilderBase<TViewComponent, TBuilder>` |
| Name(string) | `public virtual ToolbarBuilder Name(string componentName)` | Sets the wrapped `Toolbar`'s `Name`, then returns the builder to continue the fluent chain. | `SAIF.Framework.Web.Mvc` — `ViewComponentBuilderBase<TViewComponent, TBuilder>` |
| Render() | `public virtual void Render()` | Delegates to the wrapped `Toolbar`'s `Render()`. | `SAIF.Framework.Web.Mvc` — `ViewComponentBuilderBase<TViewComponent, TBuilder>` |
| ToHtmlString() | `public string ToHtmlString()` | Delegates to the wrapped `Toolbar`'s `ToHtmlString()`. | `SAIF.Framework.Web.Mvc` — `ViewComponentBuilderBase<TViewComponent, TBuilder>` |
| ToString() | `public override string ToString()` | Returns `ToHtmlString()`, so rendering the builder directly (e.g. in a Razor view) emits the toolbar's markup — currently empty, per `Toolbar`'s `WriteHtml` override. | `SAIF.Framework.Web.Mvc` — `ViewComponentBuilderBase<TViewComponent, TBuilder>` |

All members above are declared on `ViewComponentBuilderBase<TViewComponent, TBuilder>` (constructed here as `ViewComponentBuilderBase<Toolbar, ToolbarBuilder>`) and are inherited unchanged by `ToolbarBuilder`.

## Sources
- `src/Web.Mvc/UI/Toolbar/ToolbarBuilder.cs`
- `src/Web.Mvc/UI/ViewComponentBuilderBase.cs`
