Skip to main content

DxToolbarItem.Template Property

Specifies the template to display an item’s content.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment<IToolbarItemInfo> Template { get; set; }

Property Value

Type Description
RenderFragment<IToolbarItemInfo>

The template content for an object of the IToolbarItemInfo type that stores information about an item (the text, state, icon, etc.)

Remarks

Use the Template property to completely override an individual item’s content, including text, icon, child item, etc.

The example below demonstrates how to add the Search text box to the Toolbar component.

<DxToolbar ItemRenderStyleMode="ToolbarRenderStyleMode.Plain"
           Title="DevExpress Logo">
    <TitleTemplate>
        <div class="icon-logo" role="img" aria-label="@context"></div>
    </TitleTemplate>
    <Items>
        <DxToolbarItem BeginGroup="true"
                       Alignment="ToolbarItemAlignment.Right">
            <Template>
                <div class="d-flex flex-row align-items-center h-100">
                    <SearchItem CssClass="py-0" />
                </div>
            </Template>
        </DxToolbarItem>
        <DxToolbarItem IconCssClass="tb-icon tb-icon-refresh"
                       Tooltip="Refresh"
                       Alignment="ToolbarItemAlignment.Right"
                       BeginGroup="true" />
        <DxToolbarItem IconCssClass="tb-icon tb-icon-settings"
                       Tooltip="Settings" />
    </Items>
</DxToolbar>
<div class="search @CssClass">
    <input type="text" class="form-control form-control-sm search-input" placeholder="Search..." aria-label="Search">
    <span class="search-button d-flex ps-2 pe-2 me-1">
        <span class="search-icon"></span>
    </span>
</div>

@code {
    [Parameter]
    public string CssClass { get; set; }
}

Toolbar Item Template

Run Demo: Toolbar - Templates

See Also