Class SpreadsheetRibbonItem
Represents the state and metadata of a ribbon item (button, dropdown, etc.) in the SfSpreadsheet's ribbon interface.
Inherited Members
Namespace: Syncfusion.Blazor.Spreadsheet
Assembly: Syncfusion.Blazor.Spreadsheet.dll
Syntax
public class SpreadsheetRibbonItem
Remarks
This model is used to customize built-in ribbon items by controlling their visibility, enabled state, and display order. SpreadsheetRibbonItem instances are passed to the RibbonItems parameter.
- Built-in items are identified by their ItemId (e.g., "undoButton", "boldButton").
- Set IsVisible to false to hide an item from its parent group.
- Set IsEnabled to false to disable an item (grayed out but visible).
- Set Order to control item ordering within a group; null preserves existing order.
- When IsEnabled is null, the framework dynamically manages the item's state based on context.
- When IsEnabled is true or false, the state is locked by the user.
Examples
Example: Customizing ribbon items
@using Syncfusion.Blazor.Spreadsheet
@using Syncfusion.Blazor.Ribbon
<SfSpreadsheet @ref="SpreadsheetInstance"
RibbonItems="@GetItemCustomizations()">
</SfSpreadsheet>
@code {
public SfSpreadsheet SpreadsheetInstance { get; set; }
List<SpreadsheetRibbonItem> GetItemCustomizations()
{
return new List<SpreadsheetRibbonItem>
{
new SpreadsheetRibbonItem { ItemId = "strikethroughbutton", IsVisible = false },
new SpreadsheetRibbonItem { ItemId = "protectsheetbutton", IsEnabled = false },
new SpreadsheetRibbonItem { ItemId = "boldButton", Order = 1 }
};
}
}
Constructors
SpreadsheetRibbonItem()
Declaration
public SpreadsheetRibbonItem()
Properties
GroupId
Gets or sets the unique identifier of the parent group containing this item.
Declaration
public string GroupId { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the parent group's ID. The default value is Empty. |
Remarks
This property specifies which group owns this item.
IsBuiltIn
Gets a value indicating whether this is a built-in item or a custom item.
Declaration
public bool IsBuiltIn { get; }
Property Value
| Type | Description |
|---|---|
| bool | true if this is a built-in spreadsheet item; false if this is a custom item. This property is read-only and automatically managed. |
Remarks
This property is automatically set by the framework and cannot be modified by users. Built-in items correspond to standard ribbon buttons and controls such as Bold, Italic, Undo, and Redo.
IsEnabled
Gets or sets a value indicating whether the item is enabled (clickable) or disabled (grayed out).
Declaration
public bool? IsEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? | A bool? (nullable boolean) indicating the item's enabled state. The default value is null. |
Remarks
This property controls whether the item is clickable or grayed out in the UI.
- When null (default), the framework dynamically manages the item's state based on context (e.g., whether a cell is selected, whether clipboard has content). This allows the ribbon to automatically enable/disable items appropriately.
- When true, the item is always enabled, overriding dynamic state management.
- When false, the item is always disabled, overriding dynamic state management.
Use explicit true/false values to lock an item's state when you want to override automatic management.
IsVisible
Gets or sets a value indicating whether the item is visible in its parent group.
Declaration
public bool IsVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating item visibility. The default value is true. |
Remarks
When false, the item is hidden from the ribbon but can be shown later via parameter changes or method calls.
ItemId
Gets or sets the unique identifier for the ribbon item.
Declaration
public string ItemId { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the item's unique identifier. The default value is Empty. |
Remarks
For built-in items, standard IDs include:
"undoButton","redoButton"- Undo and Redo commands."boldButton","italicButton","underlineButton","strikethrough"- Text formatting buttons."fontColor","colorpicker"- Font and background color controls."protectSheetButton","protectWorkbookButton"- Protection controls.
For custom items, use a developer-provided unique identifier.
Order
Gets or sets the display order of the item within its parent group.
Declaration
public int? Order { get; set; }
Property Value
| Type | Description |
|---|---|
| int? | An int? (nullable integer) representing the desired item order. The default value is null. |