Class SfToolbar
The Toolbar control contains a group of commands that are aligned horizontally.
Inheritance
Namespace: Syncfusion.Blazor.Navigations
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfToolbar : SfBaseComponent
Constructors
SfToolbar()
Declaration
public SfToolbar()
Properties
AllowKeyboard
When this property is set to true, it allows the keyboard interaction in toolbar.
Declaration
public bool AllowKeyboard { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ChildContent
Child Content for Toolbar
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment |
CssClass
Sets the CSS classes to root element of the Toolbar that helps to customize component styles.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String |
EnableCollision
Enable or disable the popup collision.
Declaration
public bool EnableCollision { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnablePersistence
Enable or disable persisting component's state between page reloads.
Declaration
public bool EnablePersistence { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableRtl
Enable or disable rendering component in right to left direction.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Height
Specifies the height of the Toolbar in pixels/number/percentage. Number value is considered as pixels.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String |
HtmlAttributes
You can add the additional html attributes such as id, title etc., to the toolbar element. If you configured both property and equivalent html attribute then the component considers the property value.
Declaration
public Dictionary<string, object> HtmlAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
ID
Sets ID attribute for toolbar element.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Items
A list of items that is used to configure Toolbar commands.
Declaration
public List<ToolbarItem> Items { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ToolbarItem> |
OverflowMode
Specifies the Toolbar display mode when Toolbar content exceeds the viewing area. Possible modes are:
- Scrollable: All the elements are displayed in a single line with horizontal scrolling enabled.
- Popup: Prioritized elements are displayed on the Toolbar and the rest of elements are moved to the popup.
- MultiRow: Displays the overflow toolbar items as an in-line of a toolbar.
- Extended: Hide the overflowing toolbar items in the next row. Show the overflowing toolbar items when you click the expand icons. If the popup content overflows the height of the page, the rest of the elements will be hidden.
Declaration
public OverflowMode OverflowMode { get; set; }
Property Value
Type | Description |
---|---|
OverflowMode |
ScrollStep
Specifies the scrolling distance in scroller.
Declaration
public int ScrollStep { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Width
Specifies the width of the Toolbar in pixels/numbers/percentage. Number value is considered as pixels.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddItems(List<ToolbarItem>, Int32)
Adds new items to the Toolbar that accepts an list of Toolbar items.
Declaration
public void AddItems(List<ToolbarItem> items, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ToolbarItem> | items | A list of items to be added to the Toolbar. |
System.Int32 | index | Number value that determines where the command is to be added. |
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Disable(Boolean)
Specifies the value to disable/enable the Toolbar component.
When set to True
, the component will be disabled.
Declaration
public Task Disable(bool disable)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disable | Based on this Boolean value, Toolbar will be enabled (false) or disabled (true). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
EnableItems(List<Int32>, Nullable<Boolean>)
Enables or disables the specified Toolbar item.
Declaration
public void EnableItems(List<int> items, Nullable<bool> isEnable = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Int32> | items | A list of toolbar item index to be enabled or disabled. |
System.Nullable<System.Boolean> | isEnable | Boolean value that determines whether the command should be enabled or disabled. By default, |
EnableItems(Object, Nullable<Boolean>)
Enables or disables the specified Toolbar item.
Declaration
public void EnableItems(object items, Nullable<bool> isEnable = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | items | A list of toolbar item index to be enabled or disabled. |
System.Nullable<System.Boolean> | isEnable | Boolean value that determines whether the command should be enabled or disabled. By default, |
HideItem(Int32, Nullable<Boolean>)
Shows or hides the Toolbar item that is in the specified index.
Declaration
public Task HideItem(int index, Nullable<bool> isHide = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index value of target item to be hidden or shown. |
System.Nullable<System.Boolean> | isHide | Based on this Boolean value, item will be hide (true) or show (false). By default, isHide is false. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
HideItem(Object, Nullable<Boolean>)
Shows or hides the Toolbar item that is in the specified index.
Declaration
public Task HideItem(object index, Nullable<bool> isHide = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | index | Index value of target item to be hidden or shown. |
System.Nullable<System.Boolean> | isHide | Based on this Boolean value, item will be hide (true) or show (false). By default, isHide is false. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
OnAfterRenderAsync(Boolean)
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
OnParametersSetAsync()
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Refresh()
Applies all the pending property changes and render the component again.
Declaration
public Task Refresh()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
RefreshOverflow()
Refresh the whole Toolbar component without re-rendering.
- It is used to manually refresh the Toolbar overflow modes such as scrollable, popup, multi row, and extended.
- It will refresh the Toolbar component after loading items dynamically.
Declaration
public Task RefreshOverflow()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
RemoveItems(Int32)
Removes the items from the Toolbar at the specified index.
Declaration
public Task RemoveItems(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index of item which is to be removed from the Toolbar. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |