Class SpreadsheetCustomRibbonItem
Represents a custom ribbon item (button, dropdown, etc.) that can be added to an existing ribbon group in the SfSpreadsheet's ribbon interface.
Inherited Members
Namespace: Syncfusion.Blazor.Spreadsheet
Assembly: Syncfusion.Blazor.Spreadsheet.dll
Syntax
public class SpreadsheetCustomRibbonItem
Remarks
Custom items enable developers to add application-specific buttons, dropdowns, and other controls to ribbon groups. Each custom item is rendered using a RenderFragment template that defines its content and behavior.
Usage:
Examples
Example: Adding a custom ribbon item (button) to the Clipboard group
@using Syncfusion.Blazor.Spreadsheet
@using Syncfusion.Blazor.Ribbon
@using Microsoft.AspNetCore.Components
<SfSpreadsheet @ref="SpreadsheetInstance"
CustomRibbonItems="@GetCustomItems()">
</SfSpreadsheet>
@code {
public SfSpreadsheet SpreadsheetInstance { get; set; }
List<SpreadsheetCustomRibbonItem> GetCustomItems()
{
return new List<SpreadsheetCustomRibbonItem>
{
new SpreadsheetCustomRibbonItem
{
GroupId = "clipboardGroup",
Index = 3,
Template = CustomItemTemplate
}
};
}
}
Constructors
SpreadsheetCustomRibbonItem()
Declaration
public SpreadsheetCustomRibbonItem()
Properties
GroupId
Gets or sets the unique identifier of the parent group that will contain this custom item.
Declaration
public string GroupId { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the group ID (e.g., "clipboardGroup", "fontStyleGroup"). The default value is Empty. |
Remarks
This property specifies which ribbon group will host the custom item.
- For built-in groups, use standard IDs corresponding to the ribbon structure.
- If the specified group does not exist, the item will not be inserted.
- An empty string is treated as null.
Index
Gets or sets the insertion index for the custom item within its parent group.
Declaration
public int Index { get; set; }
Property Value
| Type | Description |
|---|---|
| int | An int specifying the zero-based position where the item will be inserted within the group. The default value is |
Remarks
This property controls the display order of the custom item relative to existing items in the parent group.
- Lower indices appear earlier within the group.
- When set to
-1or out of range, the item is appended to the end of the group. - Positive indices are relative to the current item collection at rendering time.
Template
Gets or sets the RenderFragment that defines the custom item's content and layout.
Declaration
public RenderFragment Template { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderFragment | A RenderFragment representing the Blazor markup to render for this item. The default value is null. |
Remarks
The developer defines the item's label, icon, and behavior within this template using standard Blazor ribbon component syntax.
The template receives no parameters and can include event handlers such as @onclick callbacks.
If null, the item will not be rendered.