
Syncfusion Blazor Ribbon
- 230 installs
- 4 repo stars
- Updated July 28, 2026
- syncfusion/blazor-ui-components-skills
Use syncfusion-blazor-ribbon for development tasks
About
syncfusion-blazor-ribbon: A skill for development. This provides functionality for development workflows.
- syncfusion-blazor-ribbon
Syncfusion Blazor Ribbon by the numbers
- 230 all-time installs (skills.sh)
- +13 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #1,668 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/syncfusion/blazor-ui-components-skills --skill syncfusion-blazor-ribbonAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 230 |
|---|---|
| repo stars | ★ 4 |
| Last updated | July 28, 2026 |
| Repository | syncfusion/blazor-ui-components-skills ↗ |
What it does
Use syncfusion-blazor-ribbon for development tasks
Files
Syncfusion Blazor Ribbon Component
Build professional Office-style ribbon interfaces with the Syncfusion Blazor Ribbon component. This skill provides comprehensive guidance on implementing, configuring, and customizing the Ribbon for Blazor applications.
Component Overview
The Ribbon is a Microsoft Office-style UI component that organizes commands and tools into tabs, groups, and collections. It provides an intuitive interface for application functionality with support for multiple item types, file menus, and extensive customization options.
Key Concepts
- Tabs: Top-level navigation containers (Home, Insert, Design, etc.)
- Groups: Logical groupings of related items within a tab (Clipboard, Font, Alignment)
- Collections: Organize items within a group (vertical or horizontal)
- Items: Individual controls (buttons, dropdowns, checkboxes, color pickers, etc.)
- File Menu: Special dropdown menu for file operations (New, Open, Save)
- Gallery: Display visual collections of related items (styles, themes, designs)
- Contextual Tabs: Dynamic tabs that appear based on selected objects or context
- Backstage View: Full-screen menu for file operations and application settings
- KeyTips: Keyboard shortcuts for accessibility and productivity
Ribbon Structure
SfRibbon (Main Container)
├── RibbonFileMenuSettings (Optional File Menu)
└── RibbonTabs
└── RibbonTab (Home, Insert, Design...)
└── RibbonGroups
└── RibbonGroup (Clipboard, Font...)
└── RibbonCollections
└── RibbonCollection (Row/Column Layout)
└── RibbonItems
└── RibbonItem (Button, Dropdown, etc.)Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and NuGet package setup
- Namespace imports and service registration
- Theme configuration
- Basic ribbon initialization with first tab and group
- Minimal working example
Ribbon Structure and Layout
📄 Read: references/ribbon-structure.md
- Tab organization and configuration
- Group creation with orientation control
- Collection hierarchy and row/column layouts
- Item definition basics
- Organizational best practices
Ribbon Items: Basic Types
📄 Read: references/ribbon-items-basic.md
- Button items with click handlers
- Checkbox items with toggle state
- DropDown items with menu options
- SplitButton items combining button and menu
- Disabled items and item sizing
Ribbon Items: Advanced Types
📄 Read: references/ribbon-items-advanced.md
- ComboBox items with data binding and filtering
- ColorPicker items for color selection
- GroupButton items with multiple/single selection modes
- Template items for custom HTML content
- DisplayOptions for layout-specific visibility
File Menu Configuration
📄 Read: references/file-menu.md
- Enabling and configuring the file menu
- Adding menu items and nested submenus
- Submenu behavior (hover vs click)
- Custom header text
- File menu events
Events and Interactions
📄 Read: references/events.md
- Component-level events (Created, TabSelecting, TabSelected)
- Ribbon state events (Expanding, Collapsing)
- Item click and selection events
- Launcher icon and overflow popup events
- Event handler patterns and examples
Gallery Items
📄 Read: references/gallery.md
- Gallery view for displaying collections of related items
- Gallery groups with custom headers
- Item dimensions and styling
- Item count configuration
- Selected item index management
- Popup dimensions customization
- Template customization for gallery items
Contextual Tabs
📄 Read: references/contextual-tabs.md
- Dynamic tab visibility control
- Contextual tab configuration
- Tab selection state management
- Show and hide tab methods
- Context-aware UI elements
Backstage View
📄 Read: references/backstage.md
- Backstage menu configuration
- Menu item and footer items
- Backstage separators
- Back button customization
- Backstage template customization
- Width and height configuration
- Backstage events
Keyboard Navigation and KeyTips
📄 Read: references/keytips.md
- KeyTips for ribbon items
- File menu keytips
- Backstage menu keytips
- Layout switcher keytips
- Launcher icon keytips
- ShowKeyTips and HideKeyTips methods
- KeyTip best practices and guidelines
Customization and Styling
📄 Read: references/customization.md
- Theme selection and application
- Item sizing and layout options
- CSS customization and class application
- RTL (Right-to-Left) support
- Overflow handling and group collapsing
Accessibility
📄 Read: references/accessibility.md
- WCAG 2.1 compliance and standards
- Keyboard navigation (Tab, Enter, Space, Arrow keys)
- ARIA attributes and semantic markup
- Screen reader support
- Focus management and visual indicators
Quick Start Example
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<div style="width: 100%">
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard" Orientation="Orientation.Row">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.SplitButton">
<RibbonSplitButtonSettings Content="Paste" IconCss="e-icons e-paste" Items="@pasteOptions">
</RibbonSplitButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut" OnClick="@OnCut">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Copy" IconCss="e-icons e-copy" OnClick="@OnCopy">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
</div>
@code {
private List<DropDownMenuItem> pasteOptions = new List<DropDownMenuItem>()
{
new DropDownMenuItem{ Text = "Keep Source Format" },
new DropDownMenuItem{ Text = "Merge Format" },
new DropDownMenuItem{ Text = "Keep Text Only" }
};
private void OnCut(MouseEventArgs args) { /* Handle cut action */ }
private void OnCopy(MouseEventArgs args) { /* Handle copy action */ }
}Common Patterns
1. Multi-Tab Ribbon
Organize related functionality into separate tabs with different commands:
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home"><!-- Home commands --></RibbonTab>
<RibbonTab HeaderText="Insert"><!-- Insert commands --></RibbonTab>
<RibbonTab HeaderText="Design"><!-- Design commands --></RibbonTab>
</RibbonTabs>
</SfRibbon>2. Grouped Commands
Group related items for better organization and UI layout:
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard"><!-- Copy/Paste items --></RibbonGroup>
<RibbonGroup HeaderText="Font"><!-- Font items --></RibbonGroup>
<RibbonGroup HeaderText="Paragraph"><!-- Alignment items --></RibbonGroup>
</RibbonGroups>
</RibbonTab>3. File Menu Integration
Include file operations menu:
<SfRibbon>
<RibbonFileMenuSettings Visible="true" MenuItems="@fileMenuItems">
</RibbonFileMenuSettings>
<RibbonTabs><!-- tabs here --></RibbonTabs>
</SfRibbon>4. Data-Bound ComboBox
Bind dropdown to data source:
<RibbonItem Type="RibbonItemType.ComboBox">
<RibbonComboBoxSettings DataSource="@fontFamilies"
FieldSettings="@fieldSettings"
AllowFiltering="true">
</RibbonComboBoxSettings>
</RibbonItem>5. Toggle Buttons
Create buttons with selected/unselected state:
<RibbonItem Type="RibbonItemType.GroupButton">
<RibbonGroupButtonSettings Selection="GroupButtonSelection.Single" Items="@alignmentOptions">
</RibbonGroupButtonSettings>
</RibbonItem>Key Properties and Configuration
Component-Level
- Tabs: Collection of
RibbonTabobjects - FileMenuSettings: Configure file menu visibility and items
- Created: Event fired when ribbon initializes
Tab-Level
- HeaderText: Tab name displayed to users
- Visible: Show/hide tabs dynamically
Group-Level
- HeaderText: Group label
- Orientation:
RoworColumnlayout - PopupHeaderText: Text in overflow popup (if EnableGroupOverflow=true)
Item-Level
- Type:
Button,Checkbox,DropDown,SplitButton,ComboBox,ColorPicker,GroupButton,Template - Disabled: Disable individual items
- DisplayOptions:
Auto,Classic,Simplified,Overflow - AllowedSizes:
Small,Medium,Large
Common Use Cases
1. Document Editor
Build a word processor ribbon with file operations, formatting, and style controls.
2. Spreadsheet Application
Create a spreadsheet ribbon with formulas, data analysis, and cell formatting.
3. Design Tool
Implement a design application ribbon with drawing tools, colors, and object manipulation.
4. Content Management System
Design a CMS ribbon with publishing options, content organization, and workflow controls.
5. Admin Dashboard
Create admin tools ribbon with user management, settings, and system controls.
6. Email Client
Build email ribbon with message actions (Reply, Forward, Delete, Archive).
7. Media Editor
Implement image/video editor ribbon with editing tools, effects, and export options.
Installation Prerequisites
- .NET 6.0 or higher
- Blazor Server or WebAssembly project
- Syncfusion.Blazor.Ribbon NuGet package
- Syncfusion.Blazor.Themes NuGet package
Theming Support
Available themes:
- Bootstrap 5 (default)
- Material Design
- Fluent UI (Microsoft)
- Tailwind CSS
- Fabric Office
- Material Dark
Themes are applied via CSS imports in index.html or App.razor.
Performance Considerations
- Use DisplayOptions to hide items not needed in specific layouts
- Implement lazy loading for complex item configurations
- Consider overflow handling for small screen sizes
- Use templates judiciously to avoid excessive rendering
Browser Support
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (responsive)
Keyboard Navigation
- Tab: Navigate between tabs
- Enter/Space: Select items or open menus
- Arrow Keys: Navigate within groups and items
- Escape: Close open menus and popups
Related Components
- Toolbar - Simpler alternative for basic toolbars
- Menu - Standalone menu component
- TabsComponent - Tabbed content without ribbon styling
- AppBar - Application header bar
Troubleshooting Tips
Ribbon not appearing:
- Verify NuGet packages are installed
- Check namespace imports in
_Imports.razor - Confirm service registration in
Program.cs
Items not visible:
- Check
Visibleproperty on tabs and items - Verify
DisplayOptionsconfiguration - Check
Disabledproperty not set totrue
Styling issues:
- Confirm theme CSS is referenced in
index.html - Check for conflicting CSS rules
- Verify
CssClassproperty syntax
Events not firing:
- Confirm event handler is bound with
@ - Check parameter types match event args
- Verify component lifecycle (use
Createdevent for initialization)
Next Steps
1. Start with Getting Started to install and set up the component 2. Learn Ribbon Structure to understand tab/group/item organization 3. Explore Item Types (Basic and Advanced) for different control options 4. Add File Menu for file operations 5. Implement Events for user interactions 6. Customize with Styling and Accessibility for production apps
For more information, visit the official Syncfusion Blazor Ribbon documentation.
Accessibility
The Syncfusion Blazor Ribbon component is built with accessibility in mind, following WCAG 2.1 Level AA standards. All ribbon items support keyboard navigation, ARIA attributes, screen reader compatibility, and focus management.
WCAG 2.1 Compliance
| Criterion | Level | Compliance | Implementation |
|---|---|---|---|
| 1.4.3 Contrast | AA | ✅ | Color contrast ratios meet standards |
| 2.1.1 Keyboard | A | ✅ | All functionality available via keyboard |
| 2.4.3 Focus Order | A | ✅ | Logical focus order through ribbon |
| 2.4.7 Focus Visible | AA | ✅ | Clear visual focus indicators |
| 3.2.1 On Focus | A | ✅ | No unexpected context changes on focus |
| 3.2.2 On Input | A | ✅ | Changes only on user request |
| 4.1.2 Name/Role/Value | A | ✅ | Proper ARIA attributes for all items |
| 4.1.3 Status Messages | AAA | ✅ | Live regions for dynamic updates |
Keyboard Navigation
Tab Navigation
Navigate between ribbon tabs with keyboard:
Tab → Move to next focusable element
Shift+Tab → Move to previous focusable elementExample with custom Tab handling:
@using Syncfusion.Blazor.Ribbon
<SfRibbon TabSelecting="@OnTabSelect">
<RibbonTabs>
<RibbonTab HeaderText="Home"><!-- Tab 1 --></RibbonTab>
<RibbonTab HeaderText="Insert"><!-- Tab 2 --></RibbonTab>
<RibbonTab HeaderText="Design"><!-- Tab 3 --></RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private void OnTabSelect(TabSelectingEventArgs args)
{
Console.WriteLine($"Tab changed: {args.SelectedTab}");
}
}Arrow Key Navigation
Within ribbon groups and items:
Left Arrow → Move to previous item in group
Right Arrow → Move to next item in group
Up Arrow → Move up in vertical group
Down Arrow → Move down in vertical groupEnter and Space Keys
Activate ribbon items:
Enter → Click button, open dropdown, select item
Space → Click button, toggle checkboxKeyboard Navigation Example
<RibbonGroup HeaderText="Clipboard" Orientation="Orientation.Row">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Copy" IconCss="e-icons e-copy">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>ARIA Attributes
Ribbon Regions
Mark semantic regions with ARIA roles:
<div role="application" aria-label="Office-style editor with ribbon">
<SfRibbon role="navigation" aria-label="Ribbon toolbar">
<!-- Ribbon content -->
</SfRibbon>
</div>Tab Labels
Provide accessible labels for tabs:
<RibbonTab HeaderText="Home" aria-label="Home tab - common formatting options">
<!-- Tab content -->
</RibbonTab>Group Labels
Add labels to grouped items:
<RibbonGroup HeaderText="Formatting" aria-label="Text formatting options">
<RibbonCollections>
<!-- Group items -->
</RibbonCollections>
</RibbonGroup>Item Labels
Provide descriptive labels for items:
<RibbonItem Type="RibbonItemType.Button" aria-label="Save document (Ctrl+S)">
<RibbonButtonSettings Content="Save" IconCss="e-icons e-save">
</RibbonButtonSettings>
</RibbonItem>Screen Reader Support
Button Items
Announce button purpose and state:
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Bold"
IconCss="e-icons e-bold"
aria-pressed="false"
aria-label="Toggle bold formatting">
</RibbonButtonSettings>
</RibbonItem>Checkbox Items
Announce checkbox state:
<RibbonItem Type="RibbonItemType.CheckBox">
<RibbonCheckBoxSettings Label="Show Ruler"
Checked="true"
aria-label="Toggle ruler visibility"
aria-checked="true">
</RibbonCheckBoxSettings>
</RibbonItem>DropDown Items
Announce available options:
<RibbonItem Type="RibbonItemType.DropDown">
<RibbonDropDownSettings Content="Style"
Items="@styleOptions"
aria-label="Text style options"
aria-haspopup="listbox">
</RibbonDropDownSettings>
</RibbonItem>
@code {
private List<DropDownMenuItem> styleOptions = new List<DropDownMenuItem>()
{
new DropDownMenuItem{ Text = "Normal", Id = "normal" },
new DropDownMenuItem{ Text = "Heading 1", Id = "h1" },
new DropDownMenuItem{ Text = "Heading 2", Id = "h2" }
};
}ComboBox Items
Announce editable list:
<RibbonItem Type="RibbonItemType.ComboBox">
<RibbonComboBoxSettings DataSource="@fonts"
FieldSettings="@fieldSettings"
aria-label="Font family selection"
aria-autocomplete="list">
</RibbonComboBoxSettings>
</RibbonItem>Focus Management
Focus Visible
Visual focus indicator configuration:
.e-ribbon-item:focus {
outline: 2px solid #0056b3; /* Sufficient contrast */
outline-offset: 2px;
}Tab Index Management
Control keyboard focus order:
<RibbonGroup HeaderText="Primary">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<!-- Primary action: first in tab order -->
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Save">
</RibbonButtonSettings>
</RibbonItem>
<!-- Secondary actions: skip tab initially -->
<RibbonItem Type="RibbonItemType.Button" TabIndex="-1">
<RibbonButtonSettings Content="Save As">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>Focus Restoration
Restore focus after closing popups:
@using Syncfusion.Blazor.Ribbon
<RibbonItem Type="RibbonItemType.DropDown">
<RibbonDropDownSettings Content="Format"
Items="@formatOptions"
PopupClosed="@OnPopupClosed">
</RibbonDropDownSettings>
</RibbonItem>
@code {
private void OnPopupClosed(DropDownPopupClosedEventArgs args)
{
// Focus returns to button automatically
Console.WriteLine("Popup closed, focus restored to button");
}
}Testing Keyboard Navigation
Manual Testing Checklist
- [ ] Tab Key: Navigate through all focusable elements
- [ ] Shift+Tab: Reverse navigation works correctly
- [ ] Enter/Space: Buttons and items activate properly
- [ ] Arrow Keys: Navigate within groups and dropdowns
- [ ] Escape: Close open menus and popups
- [ ] Focus Visible: Clear visual focus indicator appears
- [ ] Focus Order: Logical, predictable order
Testing Example
@page "/accessibility-test"
@using Syncfusion.Blazor.Ribbon
<h2>Keyboard Navigation Test</h2>
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Test Group">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Item 1" OnClick="@LogClick">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Item 2" OnClick="@LogClick">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" TabIndex="0">
<RibbonButtonSettings Content="Item 3" OnClick="@LogClick">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
<div style="margin-top: 20px;">
<h3>Test Results:</h3>
<ul>
@foreach (var result in testResults)
{
<li>@result</li>
}
</ul>
</div>
@code {
private List<string> testResults = new List<string>();
private void LogClick(MouseEventArgs args)
{
testResults.Insert(0, $"[{DateTime.Now:HH:mm:ss}] Button clicked");
if (testResults.Count > 10) testResults.RemoveAt(testResults.Count - 1);
StateHasChanged();
}
}Screen Reader Testing
NVDA (Free, Windows)
- Download from: https://www.nvaccess.org/
- Test navigation, item announcement, status updates
JAWS (Commercial, Windows)
- Industry standard screen reader
- Comprehensive test scenarios
VoiceOver (macOS/iOS)
- Built-in screen reader
- Test Touch ID interactions for mobile
Accessible Design Patterns
1. Semantic HTML
<nav role="navigation" aria-label="Main ribbon toolbar">
<SfRibbon><!-- ribbon --></SfRibbon>
</nav>2. Meaningful Icon Alt Text
<RibbonItem Type="RibbonItemType.Button" aria-label="Save document">
<RibbonButtonSettings Content="Save" IconCss="e-icons e-save">
</RibbonButtonSettings>
</RibbonItem>3. Grouping Related Items
<RibbonGroup HeaderText="Formatting" role="group" aria-label="Text formatting commands">
<!-- Group items -->
</RibbonGroup>4. Clear Error Messages
private void OnSave()
{
if (!ValidateForm())
{
ariaLive = "polite";
errorMessage = "Please fill in all required fields";
}
}Color Contrast
Sufficient Contrast
- Normal Text: Minimum 4.5:1 ratio (AA)
- Large Text: Minimum 3:1 ratio (AA)
- UI Components: Minimum 3:1 ratio
Testing Tool
- Use WebAIM Contrast Checker: https://webaim.org/resources/contrastchecker/
Accessible Ribbon Example
Complete accessible ribbon implementation:
@page "/accessible-ribbon"
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<nav role="navigation" aria-label="Document editor ribbon">
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home" aria-label="Home tab with common commands">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard"
Orientation="Orientation.Row"
role="group"
aria-label="Clipboard operations">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button"
aria-label="Cut selected text (Ctrl+X)">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button"
aria-label="Copy selected text (Ctrl+C)">
<RibbonButtonSettings Content="Copy" IconCss="e-icons e-copy">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button"
aria-label="Paste from clipboard (Ctrl+V)">
<RibbonButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
</nav>This implementation ensures full accessibility for users with disabilities, keyboard-only users, and assistive technology users.
Backstage View in Blazor Ribbon Component
The Backstage view is a full-screen menu typically accessed via the File menu button. It displays options like New, Open, Save, Print, and other file-related operations, along with application settings and user information.
When to Use Backstage
- File management operations (New, Open, Save, Save As)
- Application settings and preferences
- User account information
- Recent files/documents list
- Help and feedback
- Share options
- Print preview and options
Basic Backstage Setup
<SfRibbon>
<RibbonBackstageMenuSettings Text="File" Visible="true">
<BackstageMenuItems>
<BackstageMenuItem ID="new" Text="New" IconCss="e-icons e-file-new">
<div>New document content here</div>
</BackstageMenuItem>
<BackstageMenuItem ID="open" Text="Open" IconCss="e-icons e-folder-open">
<div>Open document content here</div>
</BackstageMenuItem>
</BackstageMenuItems>
</RibbonBackstageMenuSettings>
<RibbonTabs>
<!-- Ribbon tabs -->
</RibbonTabs>
</SfRibbon>Backstage Properties
RibbonBackstageMenuSettings
Text- Label for the backstage button (default: "File")Visible- Show/hide the backstage menu (default: false)KeyTip- Keyboard shortcut for opening backstageWidth- Width of the backstage viewHeight- Height of the backstage viewBackButtonSettings- Configuration for the back/close buttonBackstageItemClick- Event handler for backstage item clicks
BackstageMenuItem
ID- Unique identifier for the menu itemText- Display text for the menu itemIconCss- Icon class for visual indicatorSeparator- Whether to show a divider lineIsFooter- Display item at bottom of menu (default: false)KeyTip- Keyboard shortcut for the item
Basic Backstage Example
<SfRibbon>
<RibbonBackstageMenuSettings Text="File" Visible="true">
<BackstageMenuItems>
<BackstageMenuItem ID="home" Text="Home" IconCss="e-icons e-home">
@GetContent("home")
</BackstageMenuItem>
<BackstageMenuItem ID="new" Text="New" IconCss="e-icons e-file-new">
@GetContent("new")
</BackstageMenuItem>
<BackstageMenuItem ID="open" Text="Open" IconCss="e-icons e-folder-open">
@GetContent("open")
</BackstageMenuItem>
<BackstageMenuItem ID="save" Text="Save" IconCss="e-icons e-save">
@GetContent("save")
</BackstageMenuItem>
</BackstageMenuItems>
</RibbonBackstageMenuSettings>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<!-- Home tab content -->
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
RenderFragment GetContent(string item) => item switch
{
"home" => @<div class="backstage-content">
<h2>Welcome</h2>
<p>Recent documents appear here</p>
</div>,
"new" => @<div class="backstage-content">
<h2>New Document</h2>
<p>Create a new document</p>
</div>,
"open" => @<div class="backstage-content">
<h2>Open Document</h2>
<p>Browse and open existing documents</p>
</div>,
"save" => @<div class="backstage-content">
<h2>Save Document</h2>
<p>Save current document</p>
</div>,
_ => @<div>Unknown item</div>
};
}Backstage Separators
Use separators to visually group related menu items:
<BackstageMenuItems>
<BackstageMenuItem ID="new" Text="New" IconCss="e-icons e-file-new">
<!-- Content -->
</BackstageMenuItem>
<BackstageMenuItem ID="open" Text="Open" IconCss="e-icons e-folder-open">
<!-- Content -->
</BackstageMenuItem>
<BackstageMenuItem ID="save" Text="Save" IconCss="e-icons e-save">
<!-- Content -->
</BackstageMenuItem>
<BackstageMenuItem Separator="true"></BackstageMenuItem>
<BackstageMenuItem ID="print" Text="Print" IconCss="e-icons e-print">
<!-- Content -->
</BackstageMenuItem>
<BackstageMenuItem ID="export" Text="Export" IconCss="e-icons e-export">
<!-- Content -->
</BackstageMenuItem>
</BackstageMenuItems>Footer Items
Add items to the bottom of the menu using IsFooter="true":
<BackstageMenuItems>
<!-- Regular items -->
<BackstageMenuItem ID="new" Text="New" IconCss="e-icons e-file-new">
<!-- Content -->
</BackstageMenuItem>
<!-- Separator before footer items -->
<BackstageMenuItem Separator="true"></BackstageMenuItem>
<!-- Footer items -->
<BackstageMenuItem ID="options" Text="Options" IconCss="e-icons e-settings" IsFooter="true">
<div class="backstage-content">
<h3>Application Options</h3>
<!-- Options content -->
</div>
</BackstageMenuItem>
<BackstageMenuItem ID="account" Text="Account" IconCss="e-icons e-people" IsFooter="true">
<div class="backstage-content">
<h3>User Account</h3>
<!-- Account content -->
</div>
</BackstageMenuItem>
</BackstageMenuItems>Back Button Customization
<RibbonBackstageMenuSettings
Text="File"
Visible="true"
BackButtonSettings="@backButtonConfig">
<BackstageMenuItems>
<!-- Items -->
</BackstageMenuItems>
</RibbonBackstageMenuSettings>
@code {
BackstageBackButtonSettings backButtonConfig = new BackstageBackButtonSettings
{
Text = "Back to Document",
IconCss = "e-icons e-back",
Visible = true
};
}Backstage Events
<RibbonBackstageMenuSettings
Text="File"
Visible="true"
BackstageItemClick="OnBackstageItemClick">
<BackstageMenuItems>
<BackstageMenuItem ID="new" Text="New" IconCss="e-icons e-file-new">
<!-- Content -->
</BackstageMenuItem>
</BackstageMenuItems>
</RibbonBackstageMenuSettings>
@code {
private void OnBackstageItemClick(BackstageItemClickEventArgs args)
{
Console.WriteLine($"Clicked: {args.Item.ID}");
// Handle the click
}
}Backstage with Custom Layout
<RibbonBackstageMenuSettings Text="File" Visible="true">
<Template>
<div style="display: flex; width: 100%; height: 100%">
<!-- Left menu -->
<div style="width: 150px; background: #f0f0f0; padding: 10px">
<ul style="list-style: none; padding: 0">
<li @onclick="() => SelectContent('new')">New</li>
<li @onclick="() => SelectContent('open')">Open</li>
<li @onclick="() => SelectContent('save')">Save</li>
</ul>
</div>
<!-- Right content -->
<div style="flex: 1; padding: 20px">
@GetContent(selectedContent)
</div>
</div>
</Template>
</RibbonBackstageMenuSettings>
@code {
private string selectedContent = "new";
private void SelectContent(string content)
{
selectedContent = content;
}
RenderFragment GetContent(string item) => item switch
{
"new" => @<div><h2>New Document</h2></div>,
"open" => @<div><h2>Open Document</h2></div>,
"save" => @<div><h2>Save Document</h2></div>,
_ => @<div></div>
};
}Best Practices
- Logical organization: Group related items together
- Use separators: Clearly separate different sections (File, Recent, Settings)
- Icon consistency: Use appropriate icons for each menu item
- Content clarity: Provide clear, descriptive content for each backstage view
- Performance: Avoid heavy content rendering for better performance
- Keyboard navigation: Implement KeyTips for accessibility
- Recent items: Show recently used documents in the backstage view
- Save location: Consider adding save location options to backstage
Common Backstage Structure
File Menu
├── Home (Recent documents)
├── New (New document templates)
├── Open (Browse/open files)
├── Save (Save options)
├── Save As (Save with different name/format)
├── Print (Print preview and options)
├── ---separator---
├── Export (Export to different formats)
├── Share (Sharing options)
├── ---separator---
└── Options (Application settings) [Footer]Performance Considerations
- Use content templates to lazy load backstage content
- Avoid heavy rendering in backstage items
- Minimize backstage view height/width when possible
- Cache backstage content if frequently accessed
Accessibility
- Ensure all menu items have meaningful icons and labels
- Implement KeyTips for keyboard navigation
- Provide meaningful descriptions for content
- Support screen readers with proper ARIA attributes
Related Components
- File Menu - For simpler file operations
- Contextual Tabs - For context-specific commands
- Gallery - For style/template selection
- KeyTips - For keyboard shortcuts
Contextual Tabs in Blazor Ribbon Component
Contextual tabs are tabs that appear dynamically based on context, such as when a user selects an image, table, or other object. They provide task-specific commands that are only relevant when certain conditions are met.
When to Use Contextual Tabs
- Image selection (e.g., Picture Format tab in Office)
- Table selection (e.g., Table Design tab in Office)
- Text object selection
- Chart or diagram selection
- Any context-dependent command set
Basic Contextual Tab
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<!-- Regular ribbon tabs -->
</RibbonTab>
</RibbonTabs>
<RibbonContextualTabs>
<RibbonContextualTab @bind-Visible="@isImageSelected">
<RibbonTabs>
<RibbonTab HeaderText="Picture Format">
<!-- Picture-specific commands -->
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
</RibbonContextualTabs>
</SfRibbon>
@code {
private bool isImageSelected = false;
}Contextual Tab Properties
RibbonContextualTab
Visible- Show/hide the contextual tab and its contentsIsSelected- Set the tab as the active/selected tabRibbonTabs- Collection of tabs within the contextual tab
Showing/Hiding Contextual Tabs
Using Visible Property
<SfRibbon>
<RibbonContextualTabs>
<RibbonContextualTab @bind-Visible="@isTableSelected">
<RibbonTabs>
<RibbonTab HeaderText="Table Design" ID="TableDesign">
<RibbonGroups>
<RibbonGroup HeaderText="Table Styles">
<!-- Table styling options -->
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
</RibbonContextualTabs>
</SfRibbon>
@code {
private bool isTableSelected = false;
private void OnTableInserted()
{
isTableSelected = true;
}
private void OnTableRemoved()
{
isTableSelected = false;
}
}Using ShowTabAsync/HideTabAsync Methods
<SfButton @onclick="ShowImageFormatTab">Select Image</SfButton>
<SfButton @onclick="HideImageFormatTab">Deselect Image</SfButton>
<SfRibbon @ref="ribbon">
<RibbonContextualTabs>
<RibbonContextualTab @bind-Visible="@isImageVisible">
<RibbonTabs>
<RibbonTab HeaderText="Picture Format" ID="PictureFormat">
<RibbonGroups>
<RibbonGroup HeaderText="Adjust">
<!-- Image adjustment options -->
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
</RibbonContextualTabs>
</SfRibbon>
@code {
SfRibbon ribbon;
private bool isImageVisible = false;
private async Task ShowImageFormatTab()
{
isImageVisible = true;
await ribbon.ShowTabAsync("PictureFormat");
}
private async Task HideImageFormatTab()
{
isImageVisible = false;
await ribbon.HideTabAsync("PictureFormat");
}
}Multiple Contextual Tabs
<SfRibbon>
<RibbonContextualTabs>
<RibbonContextualTab @bind-Visible="@isImageSelected" @bind-IsSelected="@isImageTabActive">
<RibbonTabs>
<RibbonTab HeaderText="Picture Format">
<RibbonGroups>
<RibbonGroup HeaderText="Picture Styles">
<!-- Image styling options -->
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
<RibbonContextualTab @bind-Visible="@isTableSelected" @bind-IsSelected="@isTableTabActive">
<RibbonTabs>
<RibbonTab HeaderText="Table Design">
<RibbonGroups>
<RibbonGroup HeaderText="Table Styles">
<!-- Table styling options -->
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
<RibbonContextualTab @bind-Visible="@isChartSelected" @bind-IsSelected="@isChartTabActive">
<RibbonTabs>
<RibbonTab HeaderText="Chart Design">
<RibbonGroups>
<RibbonGroup HeaderText="Chart Layouts">
<!-- Chart layout options -->
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
</RibbonContextualTabs>
</SfRibbon>
@code {
private bool isImageSelected = false;
private bool isImageTabActive = false;
private bool isTableSelected = false;
private bool isTableTabActive = false;
private bool isChartSelected = false;
private bool isChartTabActive = false;
}Setting Selected State
Use IsSelected to automatically activate a contextual tab when it becomes visible:
<RibbonContextualTab @bind-Visible="@isImageSelected" @bind-IsSelected="@true">
<RibbonTabs>
<RibbonTab HeaderText="Picture Format">
<!-- Commands automatically shown when image selected -->
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
@code {
private bool isImageSelected = false;
}Contextual Tab Example: Image Selection
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Insert">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings
Content="Insert Image"
IconCss="e-icons e-image"
OnClick="@InsertImage">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
<RibbonContextualTabs>
<RibbonContextualTab @bind-Visible="@isImageSelected" @bind-IsSelected="@isImageTabActive">
<RibbonTabs>
<RibbonTab HeaderText="Picture Format" ID="PictureFormat">
<RibbonGroups>
<RibbonGroup HeaderText="Adjust">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Brightness" IconCss="e-icons e-brightness"></RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Contrast" IconCss="e-icons e-contrast"></RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</RibbonContextualTab>
</RibbonContextualTabs>
</SfRibbon>
@code {
private bool isImageSelected = false;
private bool isImageTabActive = false;
private void InsertImage()
{
isImageSelected = true;
isImageTabActive = true;
}
}Best Practices
- Logical grouping: Group related contextual tabs for similar object types
- Clear naming: Use descriptive tab names that indicate the object type (e.g., "Picture Format")
- Auto-selection: Set
IsSelected="true"to automatically activate when visible - Exclusive contexts: Show only relevant contextual tabs for the current selection
- Keyboard navigation: Ensure contextual tabs are keyboard accessible
- Visual feedback: Provide clear indication of which object is selected
- Consistent commands: Place similar commands in same location across contextual tabs
Performance Considerations
- Define contextual tabs once, reuse by toggling
Visibleproperty - Avoid creating/destroying contextual tabs dynamically
- Lazy load complex content if needed
- Monitor number of contextual tabs to maintain UI responsiveness
Contextual Tab Methods
ShowTabAsync
Programmatically show a contextual tab.
await ribbon.ShowTabAsync("TabID");HideTabAsync
Programmatically hide a contextual tab.
await ribbon.HideTabAsync("TabID");Related Components
- Gallery - For style/template selection within contextual tabs
- File Menu - For file operations
- Backstage View - For application settings
- KeyTips - For keyboard navigation of contextual tabs
Customization and Styling
Table of Contents
Theming
Available Themes
The Ribbon component supports multiple professional themes:
<!-- Bootstrap 5 (Default) -->
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<!-- Material Design -->
<link href="_content/Syncfusion.Blazor.Themes/material.css" rel="stylesheet" />
<!-- Fluent UI (Microsoft) -->
<link href="_content/Syncfusion.Blazor.Themes/fluent.css" rel="stylesheet" />
<!-- Tailwind CSS -->
<link href="_content/Syncfusion.Blazor.Themes/tailwind.css" rel="stylesheet" />
<!-- Fabric Office -->
<link href="_content/Syncfusion.Blazor.Themes/fabric.css" rel="stylesheet" />Dark Mode Themes
Use dark theme variants:
<!-- Bootstrap 5 Dark -->
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5-dark.css" rel="stylesheet" />
<!-- Material Dark -->
<link href="_content/Syncfusion.Blazor.Themes/material-dark.css" rel="stylesheet" />
<!-- Fluent Dark -->
<link href="_content/Syncfusion.Blazor.Themes/fluent-dark.css" rel="stylesheet" />Theme Selection in App
@page "/theme-selector"
@using Syncfusion.Blazor.Ribbon
<div style="margin-bottom: 20px;">
<label>Select Theme:</label>
<select @onchange="@ChangeTheme">
<option value="bootstrap5">Bootstrap 5</option>
<option value="material">Material</option>
<option value="fluent">Fluent</option>
<option value="tailwind">Tailwind</option>
</select>
</div>
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Tools">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Action"></RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private void ChangeTheme(ChangeEventArgs e)
{
string selectedTheme = e.Value.ToString();
// Dynamically load theme CSS (implementation depends on your setup)
Console.WriteLine($"Theme changed to: {selectedTheme}");
}
}Sizing and Layout
Item Sizing Options
Control visual prominence with size:
<RibbonGroup HeaderText="Emphasis">
<RibbonCollections>
<!-- Large: Primary action -->
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" AllowedSizes="RibbonItemSize.Large">
<RibbonButtonSettings Content="Publish" IconCss="e-icons e-publish">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
<!-- Small: Secondary actions -->
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" AllowedSizes="RibbonItemSize.Small">
<RibbonButtonSettings Content="Archive" IconCss="e-icons e-archive">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" AllowedSizes="RibbonItemSize.Small">
<RibbonButtonSettings Content="Delete" IconCss="e-icons e-delete">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>Group Orientation
Row (Horizontal) - Items side-by-side:
<RibbonGroup HeaderText="Clipboard" Orientation="Orientation.Row">
<!-- Items arranged horizontally -->
</RibbonGroup>Column (Vertical) - Items stacked:
<RibbonGroup HeaderText="View Options" Orientation="Orientation.Column">
<!-- Items arranged vertically -->
</RibbonGroup>CSS Customization
Custom CSS Classes
Apply custom styles to items:
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Custom Style" CssClass="custom-button">
</RibbonButtonSettings>
</RibbonItem>
<style>
.custom-button {
background-color: #FF6B6B !important;
color: white !important;
}
.custom-button:hover {
background-color: #EE5A52 !important;
}
</style>Styling Ribbon Groups
<RibbonGroup HeaderText="Important" CssClass="important-group">
<!-- Group items -->
</RibbonGroup>
<style>
.important-group {
border-left: 4px solid #FF6B6B;
background-color: #FFF5F5;
}
.important-group::after {
content: "⚠";
margin-left: 8px;
}
</style>Custom Ribbon Width
<div style="width: 100%; max-width: 1400px; margin: 0 auto;">
<SfRibbon style="width: 100%;">
<!-- Ribbon content -->
</SfRibbon>
</div>Icon Customization
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Custom Icon"
IconCss="e-icons e-custom custom-icon-style">
</RibbonButtonSettings>
</RibbonItem>
<style>
.custom-icon-style {
font-size: 20px !important;
color: #007bff !important;
}
</style>RTL Support
Enable RTL
Apply RTL direction to the ribbon:
<SfRibbon style="direction: rtl;">
<RibbonTabs>
<RibbonTab HeaderText="الرئيسية">
<!-- Content in RTL -->
</RibbonTab>
</RibbonTabs>
</SfRibbon>RTL Styling
<html dir="rtl" lang="ar">
<head>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>
</body>
</html>Overflow Handling
Enable Group Overflow
Allow items to overflow to popup when space is limited:
<RibbonGroup HeaderText="Formatting"
Orientation="Orientation.Row"
EnableGroupOverflow="true"
PopupHeaderText="More Options">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Classic">
<RibbonButtonSettings Content="Bold" IconCss="e-icons e-bold">
</RibbonButtonSettings>
</RibbonItem>
<!-- More items here will overflow -->
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>DisplayOptions for Overflow
<!-- Always visible -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Auto">
<RibbonButtonSettings Content="Save"></RibbonButtonSettings>
</RibbonItem>
<!-- Only in classic layout -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Classic">
<RibbonButtonSettings Content="Options"></RibbonButtonSettings>
</RibbonItem>
<!-- Only in overflow -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Overflow">
<RibbonButtonSettings Content="Advanced"></RibbonButtonSettings>
</RibbonItem>Responsive Design
Mobile-Friendly Ribbon
@page "/responsive-ribbon"
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<style>
@media (max-width: 768px) {
.ribbon-container {
width: 100%;
}
.ribbon-group {
min-width: 100%;
}
}
</style>
<div class="ribbon-container">
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Edit">
<RibbonGroups>
<!-- Desktop: Horizontal layout -->
<RibbonGroup HeaderText="Clipboard"
Orientation="Orientation.Row"
CssClass="desktop-group">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" AllowedSizes="RibbonItemSize.Large">
<RibbonButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
<!-- Mobile: Vertical layout -->
<RibbonGroup HeaderText="Clipboard"
Orientation="Orientation.Column"
CssClass="mobile-group">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" AllowedSizes="RibbonItemSize.Small">
<RibbonButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
</div>
<style>
@media (min-width: 769px) {
.mobile-group {
display: none;
}
}
@media (max-width: 768px) {
.desktop-group {
display: none;
}
}
</style>Compact Ribbon for Mobile
<SfRibbon style="font-size: 12px;">
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Tools" Orientation="Orientation.Row">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" AllowedSizes="RibbonItemSize.Small">
<RibbonButtonSettings Content="Action" IconCss="e-icons e-action">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>Advanced Customization
Custom Background Color
<SfRibbon style="background-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
<!-- Ribbon content -->
</SfRibbon>Custom Font
<SfRibbon style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 14px;">
<!-- Ribbon content -->
</SfRibbon>Custom Item Colors
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Success"
CssClass="success-button"
IconCss="e-icons e-check">
</RibbonButtonSettings>
</RibbonItem>
<style>
.success-button {
background-color: #28a745 !important;
color: white !important;
border-color: #28a745 !important;
}
.success-button:hover {
background-color: #218838 !important;
border-color: #218838 !important;
}
</style>Best Practices
1. Use Themes Consistently
Pick one theme and use throughout the application for professional appearance.
2. Responsive Sizing
Adjust AllowedSizes based on screen size to maintain usability on mobile.
3. Color Contrast
Ensure sufficient contrast for accessibility (WCAG AA standard).
4. Icon Clarity
Use clear, recognizable icons with appropriate sizing.
5. RTL Consideration
Test both LTR and RTL layouts if supporting multiple languages.
6. Performance
Minimize CSS overrides; use theme variables when possible.
7. Consistency
Maintain consistent styling across all ribbons in your application.
Events and Interactions
Table of Contents
Component-Level Events
Created Event
Fires when ribbon component is fully initialized:
<SfRibbon Created="@OnRibbonCreated">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnRibbonCreated()
{
Console.WriteLine("Ribbon component created and initialized");
}
}TabSelecting Event
Fires before a tab is selected:
<SfRibbon TabSelecting="@OnTabSelecting">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnTabSelecting(TabSelectingEventArgs args)
{
Console.WriteLine($"Selecting tab: {args.SelectedTab}");
// args.Cancel = true; // To prevent tab selection
}
}TabSelected Event
Fires after a tab is successfully selected:
<SfRibbon TabSelected="@OnTabSelected">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnTabSelected(TabSelectedEventArgs args)
{
Console.WriteLine($"Tab selected: {args.SelectedTab}");
}
}Ribbon State Events
RibbonExpanding Event
Fires before ribbon expands from collapsed state:
<SfRibbon RibbonExpanding="@OnRibbonExpanding">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnRibbonExpanding(ExpandEventArgs args)
{
Console.WriteLine("Ribbon expanding");
}
}RibbonCollapsing Event
Fires before ribbon collapses:
<SfRibbon RibbonCollapsing="@OnRibbonCollapsing">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnRibbonCollapsing(CollapseEventArgs args)
{
Console.WriteLine("Ribbon collapsing");
}
}Overflow and Launcher Events
LauncherIconClick Event
Fires when launcher icon is clicked in group:
<SfRibbon LauncherIconClick="@OnLauncherClick">
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Paragraph" LauncherIcon="e-icons e-launcher">
<!-- Group items -->
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private void OnLauncherClick(LauncherClickEventArgs args)
{
Console.WriteLine($"Launcher clicked for group: {args.GroupName}");
// Open dialog for detailed settings
}
}OverflowPopupOpening Event
Fires before overflow popup opens:
<SfRibbon OverflowPopupOpening="@OnOverflowOpen">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnOverflowOpen(OverflowPopupEventArgs args)
{
Console.WriteLine("Overflow popup opening");
}
}OverflowPopupClosing Event
Fires before overflow popup closes:
<SfRibbon OverflowPopupClosing="@OnOverflowClose">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnOverflowClose(OverflowPopupEventArgs args)
{
Console.WriteLine("Overflow popup closing");
}
}Item Events
Button Item Events
OnClick - When button is clicked:
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Save" OnClick="@OnSaveClick">
</RibbonButtonSettings>
</RibbonItem>
@code {
private void OnSaveClick(MouseEventArgs args)
{
Console.WriteLine("Save button clicked");
}
}Created - When button is initialized:
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Cut" Created="@OnButtonCreated">
</RibbonButtonSettings>
</RibbonItem>
@code {
private void OnButtonCreated()
{
Console.WriteLine("Button created");
}
}CheckBox Item Events
ValueChange - When checkbox is toggled:
<RibbonItem Type="RibbonItemType.CheckBox">
<RibbonCheckBoxSettings Label="Show Ruler" ValueChange="@OnRulerChange">
</RibbonCheckBoxSettings>
</RibbonItem>
@code {
private void OnRulerChange(ChangeEventArgs<bool> args)
{
Console.WriteLine($"Ruler visibility: {args.Checked}");
}
}DropDown Item Events
ItemSelecting - When dropdown item is selected:
<RibbonItem Type="RibbonItemType.DropDown">
<RibbonDropDownSettings Content="Style" Items="@styleOptions" ItemSelecting="@OnStyleSelect">
</RibbonDropDownSettings>
</RibbonItem>
@code {
private void OnStyleSelect(DropDownItemSelectEventArgs args)
{
Console.WriteLine($"Style selected: {args.Item.Text}");
}
}PopupOpening / PopupOpened - Dropdown menu lifecycle:
<RibbonDropDownSettings Content="Style"
Items="@styleOptions"
PopupOpening="@OnPopupOpen"
PopupOpened="@OnPopupOpened"
PopupClosing="@OnPopupClose"
PopupClosed="@OnPopupClosed">
</RibbonDropDownSettings>
@code {
private void OnPopupOpen(DropDownPopupOpenEventArgs args)
=> Console.WriteLine("Dropdown opening");
private void OnPopupOpened(DropDownPopupOpenedEventArgs args)
=> Console.WriteLine("Dropdown opened");
private void OnPopupClose(DropDownPopupCloseEventArgs args)
=> Console.WriteLine("Dropdown closing");
private void OnPopupClosed(DropDownPopupClosedEventArgs args)
=> Console.WriteLine("Dropdown closed");
}SplitButton Item Events
Clicked - Primary button click:
<RibbonItem Type="RibbonItemType.SplitButton">
<RibbonSplitButtonSettings Content="Paste" Items="@pasteOptions" Clicked="@OnPasteClick">
</RibbonSplitButtonSettings>
</RibbonItem>
@code {
private void OnPasteClick(SplitButtonClickedEventArgs args)
{
Console.WriteLine("Paste main button clicked");
}
}ItemSelected - Menu item selected:
<RibbonSplitButtonSettings Content="Paste"
Items="@pasteOptions"
ItemSelected="@OnPasteFormat">
</RibbonSplitButtonSettings>
@code {
private void OnPasteFormat(SplitButtonItemSelectedEventArgs args)
{
Console.WriteLine($"Paste format: {args.Item.Text}");
}
}ComboBox Item Events
ValueChange - Selected value changed:
<RibbonItem Type="RibbonItemType.ComboBox">
<RibbonComboBoxSettings DataSource="@fonts"
FieldSettings="@fieldSettings"
ValueChange="@OnFontChange">
</RibbonComboBoxSettings>
</RibbonItem>
@code {
private void OnFontChange(ComboBoxChangeEventArgs args)
{
Console.WriteLine($"Font changed: {args.Value}");
}
}Filtering - Text filtered in dropdown:
<RibbonComboBoxSettings AllowFiltering="true"
Filtering="@OnFilter">
</RibbonComboBoxSettings>
@code {
private void OnFilter(ComboBoxFilterEventArgs args)
{
Console.WriteLine($"Filtering: {args.Text}");
}
}ColorPicker Item Events
ValueChange - Color selected:
<RibbonItem Type="RibbonItemType.ColorPicker">
<RibbonColorPickerSettings ValueChange="@OnColorChange">
</RibbonColorPickerSettings>
</RibbonItem>
@code {
private void OnColorChange(ColorPickerEventArgs args)
{
Console.WriteLine($"Color: {args.Value}");
}
}GroupButton Item Events
ItemClick - Button in group clicked:
<RibbonItem Type="RibbonItemType.GroupButton">
<RibbonGroupButtonSettings Items="@alignOptions" ItemClick="@OnAlign">
</RibbonGroupButtonSettings>
</RibbonItem>
@code {
private void OnAlign(GroupButtonClickEventArgs args)
{
Console.WriteLine($"Alignment: {args.Item.Content}");
}
}Event Patterns
Complete Ribbon with All Events
@page "/ribbon-events"
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<div style="margin-bottom: 20px; padding: 10px; background-color: #f0f0f0; border-radius: 4px;">
<h3>Event Log</h3>
<div style="max-height: 150px; overflow-y: auto; background-color: white; padding: 10px; border: 1px solid #ccc;">
@foreach (var log in eventLogs)
{
<div>@log</div>
}
</div>
</div>
<SfRibbon Created="@OnCreated"
TabSelecting="@OnTabSelecting"
TabSelected="@OnTabSelected"
RibbonExpanding="@OnExpanding"
RibbonCollapsing="@OnCollapsing"
LauncherIconClick="@OnLauncher">
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut" OnClick="@OnCut">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
<RibbonTab HeaderText="Insert">
<RibbonGroups>
<RibbonGroup HeaderText="Text">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Text Box" OnClick="@OnInsertText">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private List<string> eventLogs = new List<string>();
private void LogEvent(string message)
{
eventLogs.Insert(0, $"[{DateTime.Now:HH:mm:ss}] {message}");
if (eventLogs.Count > 20) eventLogs.RemoveAt(eventLogs.Count - 1);
StateHasChanged();
}
private void OnCreated() => LogEvent("Ribbon created");
private void OnTabSelecting(TabSelectingEventArgs args) => LogEvent($"Tab selecting: {args.SelectedTab}");
private void OnTabSelected(TabSelectedEventArgs args) => LogEvent($"Tab selected: {args.SelectedTab}");
private void OnExpanding(ExpandEventArgs args) => LogEvent("Ribbon expanding");
private void OnCollapsing(CollapseEventArgs args) => LogEvent("Ribbon collapsing");
private void OnLauncher(LauncherClickEventArgs args) => LogEvent($"Launcher clicked: {args.GroupName}");
private void OnCut(MouseEventArgs args) => LogEvent("Cut clicked");
private void OnInsertText(MouseEventArgs args) => LogEvent("Insert Text clicked");
}Preventing Default Actions
Cancel events to prevent default behavior:
<SfRibbon TabSelecting="@OnTabSelectingWithCancel">
<!-- Ribbon content -->
</SfRibbon>
@code {
private void OnTabSelectingWithCancel(TabSelectingEventArgs args)
{
if (args.SelectedTab == "Insert" && !userHasPermission)
{
args.Cancel = true; // Prevent switching to Insert tab
Console.WriteLine("Tab switch cancelled - insufficient permissions");
}
}
private bool userHasPermission = false;
}Best Practices
1. Use StateHasChanged() for Dynamic Updates
private void OnItemChange()
{
// Update component state
isProcessing = true;
StateHasChanged();
}2. Debounce Frequent Events
private System.Threading.Timer debounceTimer;
private void OnFilterChange(ComboBoxFilterEventArgs args)
{
debounceTimer?.Dispose();
debounceTimer = new System.Threading.Timer(_ =>
{
Console.WriteLine($"Filtering: {args.Text}");
}, null, 300, System.Threading.Timeout.Infinite);
}3. Log Events for Debugging
Keep an event log for troubleshooting user actions.
4. Validate Before Processing
private void OnSave()
{
if (ValidateForm())
{
SaveDocument();
}
}File Menu Configuration
Implement Office-style file menu for common file operations (New, Open, Save, Print).
Enabling File Menu
Show file menu by setting Visible="true":
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.Navigations
<SfRibbon>
<RibbonFileMenuSettings Visible="true" MenuItems="@fileMenuItems">
</RibbonFileMenuSettings>
<RibbonTabs>
<!-- Ribbon tabs -->
</RibbonTabs>
</SfRibbon>
@code {
private List<MenuItem> fileMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "New", IconCss = "e-icons e-file-new", Id = "new" },
new MenuItem { Text = "Open", IconCss = "e-icons e-folder-open", Id = "open" },
new MenuItem { Text = "Save", IconCss = "e-icons e-save", Id = "save" },
new MenuItem { Text = "Save As", IconCss = "e-icons e-save", Id = "saveas" },
new MenuItem { Text = "Print", IconCss = "e-icons e-print", Id = "print" },
new MenuItem { Text = "Exit", IconCss = "e-icons e-exit", Id = "exit" }
};
}Adding Menu Items
Simple menu items with text and icons:
<RibbonFileMenuSettings Visible="true" MenuItems="@fileMenuItems">
</RibbonFileMenuSettings>
@code {
private List<MenuItem> fileMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "New", IconCss = "e-icons e-file-new", Id = "new" },
new MenuItem { Text = "Open", IconCss = "e-icons e-folder-open", Id = "open" },
new MenuItem { Text = "Recent", IconCss = "e-icons e-clock", Id = "recent" },
new MenuItem { Text = "Save", IconCss = "e-icons e-save", Id = "save" }
};
}Nested Submenus
Create multi-level menu hierarchy:
<RibbonFileMenuSettings Visible="true" MenuItems="@fileMenuItems">
</RibbonFileMenuSettings>
@code {
private List<MenuItem> fileMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "New", IconCss = "e-icons e-file-new", Id = "new" },
new MenuItem { Text = "Open", IconCss = "e-icons e-folder-open", Id = "open" },
new MenuItem { Text = "Save", IconCss = "e-icons e-save", Id = "save" },
new MenuItem {
Text = "Save As",
IconCss = "e-icons e-save",
Id = "saveas",
Items = new List<MenuItem>()
{
new MenuItem { Text = "Microsoft Word (.docx)", IconCss = "sf-icon-word", Id = "word" },
new MenuItem { Text = "Word 97-2003 (.doc)", IconCss = "sf-icon-word", Id = "word97" },
new MenuItem { Text = "PDF Document (.pdf)", IconCss = "e-icons e-export-pdf", Id = "pdf" },
new MenuItem { Text = "Plain Text (.txt)", IconCss = "e-icons e-file-text", Id = "txt" }
}
},
new MenuItem { Text = "Print", IconCss = "e-icons e-print", Id = "print" }
};
}Submenu Behavior
Open Submenu on Hover (Default)
Submenu opens when hovering over parent item:
<RibbonFileMenuSettings Visible="true"
MenuItems="@fileMenuItems"
ShowItemOnClick="false">
</RibbonFileMenuSettings>Open Submenu on Click
Change to click-based submenu opening:
<RibbonFileMenuSettings Visible="true"
MenuItems="@fileMenuItems"
ShowItemOnClick="true">
</RibbonFileMenuSettings>
@code {
private List<MenuItem> fileMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "Save As", IconCss = "e-icons e-save", Id = "saveas",
Items = new List<MenuItem>()
{
new MenuItem { Text = "Microsoft Word (.docx)", Id = "word" },
new MenuItem { Text = "PDF Document (.pdf)", Id = "pdf" }
}
}
};
}Custom Header Text
Change "File" to custom text:
<RibbonFileMenuSettings Text="Help" Visible="true" MenuItems="@helpMenuItems">
</RibbonFileMenuSettings>
@code {
private List<MenuItem> helpMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "About", IconCss = "e-icons e-info" },
new MenuItem { Text = "Documentation", IconCss = "e-icons e-help" },
new MenuItem { Text = "Contact Support", IconCss = "e-icons e-email" }
};
}File Menu Events
FileMenuOpening / FileMenuClosing
Triggered before menu state changes:
<RibbonFileMenuSettings Visible="true"
MenuItems="@fileMenuItems"
FileMenuOpening="@OnMenuOpening"
FileMenuClosing="@OnMenuClosing"
FileMenuOpened="@OnMenuOpened"
FileMenuClosed="@OnMenuClosed"
FileMenuItemRendering="@OnItemRender"
ItemSelecting="@OnItemSelect">
</RibbonFileMenuSettings>
@code {
private void OnMenuOpening(FileMenuOpenEventArgs args)
{
Console.WriteLine("File menu opening");
}
private void OnMenuClosing(FileMenuCloseEventArgs args)
{
Console.WriteLine("File menu closing");
}
private void OnMenuOpened(FileMenuOpenedEventArgs args)
{
Console.WriteLine("File menu opened");
}
private void OnMenuClosed(FileMenuClosedEventArgs args)
{
Console.WriteLine("File menu closed");
}
private void OnItemRender(FileMenuItemRenderEventArgs args)
{
Console.WriteLine($"Rendering item: {args.Item.Text}");
}
private void OnItemSelect(FileMenuItemSelectEventArgs args)
{
Console.WriteLine($"Item selected: {args.Item.Text}");
}
}Complete Example with Actions
Functional file menu with item selection handling:
@page "/file-menu-demo"
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
@using Syncfusion.Blazor.Navigations
<h2>Document Editor with File Menu</h2>
<div style="margin-bottom: 20px;">
<p>Last Action: @lastAction</p>
</div>
<SfRibbon>
<RibbonFileMenuSettings Visible="true"
MenuItems="@fileMenuItems"
ShowItemOnClick="true"
ItemSelecting="@OnFileMenuItemSelect">
</RibbonFileMenuSettings>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private string lastAction = "None";
private List<MenuItem> fileMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "New", IconCss = "e-icons e-file-new", Id = "new" },
new MenuItem { Text = "Open", IconCss = "e-icons e-folder-open", Id = "open" },
new MenuItem { Text = "Recent", IconCss = "e-icons e-clock", Id = "recent",
Items = new List<MenuItem>()
{
new MenuItem { Text = "Document1.docx", Id = "doc1" },
new MenuItem { Text = "Document2.docx", Id = "doc2" },
new MenuItem { Text = "Document3.docx", Id = "doc3" }
}
},
new MenuItem { Text = "Save", IconCss = "e-icons e-save", Id = "save" },
new MenuItem {
Text = "Save As",
IconCss = "e-icons e-save",
Id = "saveas",
Items = new List<MenuItem>()
{
new MenuItem { Text = "Microsoft Word (.docx)", IconCss = "sf-icon-word", Id = "word" },
new MenuItem { Text = "Word 97-2003 (.doc)", IconCss = "sf-icon-word", Id = "word97" },
new MenuItem { Text = "PDF Document (.pdf)", IconCss = "e-icons e-export-pdf", Id = "pdf" },
new MenuItem { Text = "Plain Text (.txt)", IconCss = "e-icons e-file-text", Id = "txt" }
}
},
new MenuItem { Text = "Print", IconCss = "e-icons e-print", Id = "print" },
new MenuItem { Text = "Exit", IconCss = "e-icons e-exit", Id = "exit" }
};
private void OnFileMenuItemSelect(FileMenuItemSelectEventArgs args)
{
string itemId = args.Item.Id;
lastAction = itemId switch
{
"new" => "Creating new document",
"open" => "Opening document",
"recent" => "Opening recent document",
"save" => "Saving document",
"saveas" => "Save As dialog",
"word" => "Saving as .docx",
"pdf" => "Saving as PDF",
"print" => "Printing document",
"exit" => "Exiting application",
_ => $"Selected: {args.Item.Text}"
};
Console.WriteLine($"File menu action: {lastAction}");
}
}Recent Documents Pattern
Common pattern for recent file list:
@code {
private List<MenuItem> BuildRecentDocuments()
{
var recentDocs = new List<MenuItem>()
{
new MenuItem { Text = "Recent", IconCss = "e-icons e-clock", Id = "recent",
Items = new List<MenuItem>()
}
};
// Add recent documents dynamically
var documents = new[] { "Report_2026.docx", "Proposal_Final.docx", "Budget_Q1.xlsx" };
foreach (var doc in documents)
{
recentDocs[0].Items.Add(new MenuItem { Text = doc, Id = doc.ToLower() });
}
return recentDocs;
}
}Icons
Common file menu icons:
e-icons e-file-new- New documente-icons e-folder-open- Opene-icons e-save- Savee-icons e-print- Printe-icons e-clock- Recente-icons e-exit- Exite-icons e-export-pdf- PDFsf-icon-word- Word documente-icons e-help- Help
Best Practices
1. Logical Menu Organization
File Menu
├── New
├── Open
├── Recent → [Document list]
├── Save
├── Save As → [Format options]
├── Print
└── Exit2. Icon Consistency
Use recognizable icons for common operations.
3. Keyboard Shortcuts
Consider adding keyboard shortcut hints in menu:
new MenuItem { Text = "Save (Ctrl+S)", IconCss = "e-icons e-save", Id = "save" }4. Separator Items
new MenuItem { Separator = true }, // Visual separator5. Disabled Menu Items
new MenuItem { Text = "Save", IconCss = "e-icons e-save", Disabled = true }Troubleshooting
Menu not appearing:
- Verify
Visible="true"is set - Check
MenuItemscollection has items
Submenu not opening:
- Confirm
ShowItemOnClickmatches your UX preference - Verify submenu items are in
Itemscollection
Events not firing:
- Confirm event handler signature matches (e.g.,
FileMenuItemSelectEventArgs) - Check event handler is bound with
@
Gallery Items in Blazor Ribbon Component
The Ribbon supports a gallery view, allowing users to interact with a collection of related items such as icons, text, or images. Gallery items can display preset styles, themes, or formatting options in a visually organized grid layout.
When to Use Gallery
- Displaying style or formatting options (e.g., table styles, paragraph styles)
- Showing preset themes or templates
- Presenting a collection of visual items for selection
- Offering quick access to commonly used design elements
Basic Gallery Implementation
<RibbonItem Type="RibbonItemType.Gallery">
<RibbonGallerySettings Groups="@galleryGroups">
</RibbonGallerySettings>
</RibbonItem>Gallery Structure
A gallery consists of:
- Groups: Logical groupings within the gallery
- Items: Individual selectable items within each group
- Popup: Extended view showing all available options
- Templates: Custom rendering for items and popup
Key Properties
Gallery Settings
Groups- Collection of gallery groups to displayItemCount- Number of items to show in the ribbon (default: 3)SelectedItemIndex- Index of the currently selected itemPopupWidth- Width of the gallery popupPopupHeight- Height of the gallery popupTemplate- Custom template for gallery itemsPopupTemplate- Custom template for gallery popup
Gallery Group
Header- Title for the group in popupItems- Collection of gallery itemsItemWidth- Width of each itemItemHeight- Height of each itemCssClass- Custom CSS class for styling
Gallery Item
Content- Text content to displayIconCss- Icon class for the itemDisabled- Whether the item is disabledCssClass- Custom CSS class for individual styling
Example: Style Gallery
<RibbonGroup HeaderText="Styles">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Gallery">
<RibbonGallerySettings
ItemCount="4"
Groups="@styleGroups"
@bind-SelectedItemIndex="@selectedStyleIndex">
</RibbonGallerySettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
@code {
private int selectedStyleIndex = 0;
private List<GalleryGroup> styleGroups = new List<GalleryGroup>
{
new GalleryGroup
{
Header = "Paragraph Styles",
ItemWidth = "100",
ItemHeight = "40",
Items = new List<GalleryItem>
{
new GalleryItem { Content = "Normal" },
new GalleryItem { Content = "Heading 1" },
new GalleryItem { Content = "Heading 2" },
new GalleryItem { Content = "Title" }
}
}
};
}Gallery with Multiple Groups
<RibbonItem Type="RibbonItemType.Gallery">
<RibbonGallerySettings Groups="@transitionGroups">
</RibbonGallerySettings>
</RibbonItem>
@code {
private List<GalleryGroup> transitionGroups = new List<GalleryGroup>
{
new GalleryGroup
{
Header = "Subtle Transitions",
Items = new List<GalleryItem>
{
new GalleryItem { Content = "None", IconCss = "e-icons e-rectangle" },
new GalleryItem { Content = "Fade", IconCss = "e-icons e-send-backward" },
new GalleryItem { Content = "Reveal", IconCss = "e-icons e-bring-forward" }
}
},
new GalleryGroup
{
Header = "Exciting Transitions",
Items = new List<GalleryItem>
{
new GalleryItem { Content = "Zoom", IconCss = "e-icons e-zoom-to-fit" },
new GalleryItem { Content = "Wipe", IconCss = "e-icons e-send-backward" },
new GalleryItem { Content = "Pop", IconCss = "e-icons e-bring-forward" }
}
}
};
}Customizing Gallery Items
Using CSS Classes
<RibbonItem Type="RibbonItemType.Gallery">
<RibbonGallerySettings Groups="@customGroups">
</RibbonGallerySettings>
</RibbonItem>
<style>
.e-ribbon-gallery-item.status-good {
background: #c7ebc9;
border-left: 4px solid #107c10;
}
.e-ribbon-gallery-item.status-bad {
background: #ffb6b6;
border-left: 4px solid #d42b1f;
}
.e-ribbon-gallery-item.status-neutral {
background: #eedd9d;
border-left: 4px solid #ffb900;
}
</style>
@code {
private List<GalleryGroup> customGroups = new List<GalleryGroup>
{
new GalleryGroup
{
Items = new List<GalleryItem>
{
new GalleryItem { Content = "Good", CssClass = "status-good" },
new GalleryItem { Content = "Bad", CssClass = "status-bad" },
new GalleryItem { Content = "Neutral", CssClass = "status-neutral" }
}
}
};
}Gallery Events
The following events are available:
| Event | Args | Description |
|---|---|---|
| PopupOpening | GalleryPopupOpenEventArgs | Triggers before gallery popup opens |
| PopupClosing | GalleryPopupCloseEventArgs | Triggers before gallery popup closes |
| ItemHover | GalleryItemHoverEventArgs | Triggers when hovering over an item |
| ItemRendering | GalleryItemRenderEventArgs | Triggers during item rendering |
| Selecting | GallerySelectEventArgs | Triggers before item selection |
| Selected | GallerySelectedEventArgs | Triggers after item selection |
Event Handler Example
<RibbonItem Type="RibbonItemType.Gallery">
<RibbonGallerySettings
Groups="@galleryGroups"
Selected="OnGalleryItemSelected"
PopupOpening="OnPopupOpening">
</RibbonGallerySettings>
</RibbonItem>
@code {
private void OnGalleryItemSelected(GallerySelectedEventArgs args)
{
// Handle item selection
Console.WriteLine($"Selected item: {args.Item.Content}");
}
private void OnPopupOpening(GalleryPopupOpenEventArgs args)
{
// Handle popup opening
Console.WriteLine("Gallery popup is opening");
}
}Gallery Popup Configuration
<RibbonItem Type="RibbonItemType.Gallery">
<RibbonGallerySettings
PopupWidth="400"
PopupHeight="300"
Groups="@galleryGroups">
</RibbonGallerySettings>
</RibbonItem>Custom Gallery Templates
<RibbonItem Type="RibbonItemType.Gallery">
<Template Context="context">
<div class="custom-gallery-item">
<span>@context.Content</span>
</div>
</Template>
<PopupTemplate Context="context">
<div class="custom-gallery-popup">
<table>
<tr>
<td>@context.Content</td>
</tr>
</table>
</div>
</PopupTemplate>
</RibbonItem>Best Practices
- Limit visible items: Keep the
ItemCountsmall (2-5) for ribbon display - Use groups: Organize related items into logical groups in the popup
- Provide clear labels: Use descriptive content text for gallery items
- Set appropriate dimensions: Adjust
ItemWidthandItemHeightfor consistent appearance - Handle selection: Implement
Selectedevent to respond to user choices - Use icons: Combine icons with text for visual clarity
- Template consistency: Ensure custom templates match gallery item structure
Common Patterns
Table Styles Gallery
Display preset table formatting styles for quick selection.
Paragraph Styles Gallery
Show built-in or custom paragraph styles for formatting.
Color Schemes Gallery
Present color palette options for theme selection.
Shape Gallery
Display shape options for drawing or inserting.
Performance Tips
- Limit the number of items per group to maintain performance
- Use templates judiciously to avoid excessive rendering
- Implement lazy loading for large galleries if needed
- Cache gallery groups to avoid recreation on each render
Related Components
- File Menu - For file operations and settings
- Contextual Tabs - For context-specific options
- Backstage View - For application settings and information
Getting Started with Blazor Ribbon
Installation and Setup
This guide walks you through installing and configuring the Syncfusion Blazor Ribbon component in your Blazor project.
Step 1: Install NuGet Packages
Install the required Syncfusion packages:
Using Package Manager:
Install-Package Syncfusion.Blazor.Ribbon
Install-Package Syncfusion.Blazor.ThemesUsing .NET CLI:
dotnet add package Syncfusion.Blazor.Ribbon
dotnet add package Syncfusion.Blazor.Themes
dotnet restoreStep 2: Import Namespaces
Add these imports to your ~/_Imports.razor file:
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons // If using split buttons or dropdownsStep 3: Register Syncfusion Service
Register the Syncfusion Blazor service in Program.cs:
using Syncfusion.Blazor;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
// Register Syncfusion Blazor service
builder.Services.AddSyncfusionBlazor();
await builder.Build().RunAsync();For Blazor Server:
services.AddSyncfusionBlazor();Step 4: Add Theme Stylesheet
Add the theme CSS reference to your index.html or App.razor:
In `index.html` (WebAssembly/Web App):
<head>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>
</body>In `App.razor` (Blazor Server):
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>Available Themes:
bootstrap5.css- Bootstrap 5 (recommended)material.css- Material Designfluent.css- Fluent UI (Microsoft)tailwind.css- Tailwind CSSfabric.css- Office Fabric
Step 5: Create Your First Ribbon
Add a basic ribbon to a page (Pages/Index.razor):
@page "/"
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<div style="width: 100%">
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard" Orientation="Orientation.Row">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
</div>Step 6: Run Your Application
WebAssembly:
dotnet runServer:
dotnet runNavigate to https://localhost:5001 (or your configured URL). You should see the ribbon with a Home tab and Clipboard group.
Minimal Working Example
Complete minimal example with all necessary setup:
@page "/ribbon-demo"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<h2>My First Ribbon</h2>
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Editing">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Save" IconCss="e-icons e-save">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>Adding Icons
Use Syncfusion's built-in icon library (e-icons class) with common icon names:
<RibbonItem Type="RibbonItemType.Button">
<RibbonButtonSettings Content="Save" IconCss="e-icons e-save"></RibbonButtonSettings>
</RibbonItem>Common Icons:
e-save- Savee-cut- Cute-copy- Copye-paste- Pastee-undo- Undoe-redo- Redoe-print- Printe-bold- Bolde-italic- Italice-underline- Underline
For full icon list, see Syncfusion icon documentation.
Project Types
Blazor WebAssembly
// Program.cs
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddSyncfusionBlazor();Blazor Server
// Startup.cs or Program.cs (depends on .NET version)
services.AddSyncfusionBlazor();Blazor Web App (.NET 8+)
// Program.cs
builder.Services.AddSyncfusionBlazor();Add @rendermode InteractiveServer or @rendermode InteractiveWebAssembly to your page.
Troubleshooting
Issue: "SfRibbon is not recognized"
- Solution: Add
@using Syncfusion.Blazor.Ribbonto_Imports.razor
Issue: Ribbon appears unstyled
- Solution: Verify theme CSS link in
index.htmlorApp.razor - Check: CDN availability or switch to different theme
Issue: Icons not displaying
- Solution: Ensure
syncfusion-blazor.min.jsscript is loaded - Check: Icon CSS classes are correct (e.g.,
e-icons e-save)
Issue: Component not rendering
- Solution: Verify service is registered in
Program.cs - Confirm: Project has correct .NET version (6.0+)
Render Modes (Blazor Web App)
If using Blazor Web App (.NET 8+), specify render mode on the component:
@rendermode InteractiveServeror
@rendermode InteractiveWebAssemblyLicense Configuration
If using trial or commercial license, register in Program.cs:
using Syncfusion.Licensing;
// Add before calling builder.Build()
SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY");
var host = builder.Build();Get a free community license: https://www.syncfusion.com/sales/products
Next Steps
1. Learn about Ribbon Structure (tabs, groups, collections, items) 2. Explore Different Item Types (buttons, dropdowns, checkboxes, etc.) 3. Add File Menu for file operations 4. Handle Events for user interactions 5. Apply Theming for consistent styling
For more examples and demos, visit: https://blazor.syncfusion.com/demos/ribbon/
KeyTips in Blazor Ribbon Component
KeyTips enable keyboard-only navigation of the Ribbon interface. Users press Alt (or Cmd on macOS) followed by letter combinations to access ribbon commands without using the mouse. This improves accessibility and productivity for keyboard-centric workflows.
When to Use KeyTips
- Creating accessible ribbon interfaces
- Supporting keyboard-first workflows
- Improving productivity for power users
- Meeting accessibility standards (WCAG 2.1)
- Enterprise applications where keyboard navigation is critical
Enabling KeyTips
Enable KeyTips at the ribbon level:
<SfRibbon EnableKeyTips="true">
<!-- Ribbon content -->
</SfRibbon>KeyTips for Ribbon Tabs
<RibbonTab HeaderText="Home" KeyTip="H">
<RibbonGroups>
<!-- Groups -->
</RibbonGroups>
</RibbonTab>
<RibbonTab HeaderText="Insert" KeyTip="I">
<RibbonGroups>
<!-- Groups -->
</RibbonGroups>
</RibbonTab>
<RibbonTab HeaderText="Design" KeyTip="D">
<RibbonGroups>
<!-- Groups -->
</RibbonGroups>
</RibbonTab>KeyTips for Groups
<RibbonGroup HeaderText="Clipboard" KeyTip="CD">
<RibbonCollections>
<!-- Items -->
</RibbonCollections>
</RibbonGroup>
<RibbonGroup HeaderText="Font" KeyTip="FB">
<RibbonCollections>
<!-- Items -->
</RibbonCollections>
</RibbonGroup>KeyTips for Ribbon Items
<RibbonItem Type="RibbonItemType.SplitButton" KeyTip="PA">
<RibbonSplitButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonSplitButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" KeyTip="CU">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" KeyTip="CO">
<RibbonButtonSettings Content="Copy" IconCss="e-icons e-copy">
</RibbonButtonSettings>
</RibbonItem>KeyTips for File Menu
<RibbonFileMenuSettings Visible="true" MenuItems="@fileMenuItems" KeyTip="F">
</RibbonFileMenuSettings>
@code {
List<MenuItem> fileMenuItems = new List<MenuItem>()
{
new MenuItem { Text = "New", IconCss = "e-icons e-file-new", Id = "new" },
new MenuItem { Text = "Open", IconCss = "e-icons e-folder-open", Id = "open" },
new MenuItem { Text = "Save", IconCss = "e-icons e-save", Id = "save" }
};
}KeyTips for Backstage Menu
<RibbonBackstageMenuSettings KeyTip="F" Visible="true">
<BackstageMenuItems>
<BackstageMenuItem KeyTip="H" ID="home" Text="Home" IconCss="e-icons e-home">
<!-- Content -->
</BackstageMenuItem>
<BackstageMenuItem KeyTip="N" ID="new" Text="New" IconCss="e-icons e-file-new">
<!-- Content -->
</BackstageMenuItem>
<BackstageMenuItem KeyTip="O" ID="open" Text="Open" IconCss="e-icons e-folder-open">
<!-- Content -->
</BackstageMenuItem>
</BackstageMenuItems>
</RibbonBackstageMenuSettings>KeyTips for Layout Switcher
<SfRibbon EnableKeyTips="true" LayoutSwitcherKeyTip="LS">
<!-- Ribbon content -->
</SfRibbon>KeyTips for Launcher Icons
<RibbonGroup HeaderText="Clipboard" ShowLauncherIcon="true" LauncherIconKeyTip="L">
<RibbonCollections>
<!-- Items -->
</RibbonCollections>
</RibbonGroup>KeyTips for Group Button Items
For group buttons, assign KeyTips to individual items:
<RibbonItem Type="RibbonItemType.GroupButton" ID="formatGroup">
<RibbonGroupButtonSettings Selection="GroupButtonSelection.Single" Items="@formatItems">
</RibbonGroupButtonSettings>
</RibbonItem>
@code {
List<GroupButtonItem> formatItems = new List<GroupButtonItem>
{
new GroupButtonItem
{
IconCss = "e-icons e-bold",
Content = "Bold",
KeyTip = "1"
},
new GroupButtonItem
{
IconCss = "e-icons e-italic",
Content = "Italic",
KeyTip = "2"
},
new GroupButtonItem
{
IconCss = "e-icons e-underline",
Content = "Underline",
KeyTip = "3"
}
};
}Complete Example with KeyTips
<SfRibbon EnableKeyTips="true">
<RibbonFileMenuSettings Visible="true" KeyTip="F">
</RibbonFileMenuSettings>
<RibbonTabs>
<RibbonTab HeaderText="Home" KeyTip="H">
<RibbonGroups>
<RibbonGroup HeaderText="Clipboard" KeyTip="CD" ShowLauncherIcon="true" LauncherIconKeyTip="L">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.SplitButton" KeyTip="PA">
<RibbonSplitButtonSettings Content="Paste" IconCss="e-icons e-paste">
</RibbonSplitButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" KeyTip="CU">
<RibbonButtonSettings Content="Cut" IconCss="e-icons e-cut">
</RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" KeyTip="CO">
<RibbonButtonSettings Content="Copy" IconCss="e-icons e-copy">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
<RibbonGroup HeaderText="Font" KeyTip="FB">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.ComboBox" KeyTip="FF">
<RibbonComboBoxSettings DataSource="@fontFamilies">
</RibbonComboBoxSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
<RibbonTab HeaderText="Insert" KeyTip="I">
<RibbonGroups>
<RibbonGroup HeaderText="Tables" KeyTip="T">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.Button" KeyTip="TI">
<RibbonButtonSettings Content="Table" IconCss="e-icons e-table">
</RibbonButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
List<string> fontFamilies = new List<string> { "Arial", "Calibri", "Georgia" };
}KeyTip Methods
ShowKeyTipsAsync
Display KeyTips programmatically:
await ribbon.ShowKeyTipsAsync();Activate a specific KeyTip:
await ribbon.ShowKeyTipsAsync("H"); // Activate Home tabHideKeyTipsAsync
Hide all visible KeyTips:
await ribbon.HideKeyTipsAsync();KeyTip Guidelines and Best Practices
1. Uniqueness
Each KeyTip must be unique. Avoid duplicating KeyTips across different items.
<!-- ✓ Good - Unique KeyTips -->
<RibbonItem Type="RibbonItemType.Button" KeyTip="C">
<RibbonButtonSettings Content="Copy"></RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" KeyTip="X">
<RibbonButtonSettings Content="Cut"></RibbonButtonSettings>
</RibbonItem>
<!-- ✗ Bad - Duplicate KeyTips -->
<RibbonItem Type="RibbonItemType.Button" KeyTip="C">
<RibbonButtonSettings Content="Copy"></RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" KeyTip="C">
<RibbonButtonSettings Content="Close"></RibbonButtonSettings>
</RibbonItem>2. Hierarchy Consistency
Use meaningful, consistent patterns for multi-character KeyTips:
<!-- ✓ Good - Hierarchical KeyTips -->
<RibbonTab HeaderText="Format" KeyTip="O">
<RibbonGroup HeaderText="Text" KeyTip="T">
<RibbonItem KeyTip="B">Bold</RibbonItem> <!-- Alt+O, T, B -->
<RibbonItem KeyTip="I">Italic</RibbonItem> <!-- Alt+O, T, I -->
</RibbonGroup>
</RibbonTab>3. Intuitive Shortcuts
Use first letters or logical mnemonics:
<!-- ✓ Good - Intuitive KeyTips -->
<RibbonItem Type="RibbonItemType.Button" KeyTip="C">
<RibbonButtonSettings Content="Copy"></RibbonButtonSettings>
</RibbonItem>
<RibbonItem Type="RibbonItemType.Button" KeyTip="P">
<RibbonButtonSettings Content="Paste"></RibbonButtonSettings>
</RibbonItem>4. Avoidable KeyTips
Don't use single letters that conflict with standard shortcuts:
<!-- Avoid these single-letter KeyTips -->
<!-- Alt+A (typically: Select All) -->
<!-- Alt+X (typically: Cut in some apps) -->
<!-- Alt+Z (typically: Undo) -->
<!-- Alt+Y (typically: Redo) -->5. Documentation
Provide a KeyTip reference for users:
<div class="keytip-reference">
<h3>Keyboard Shortcuts</h3>
<p>Alt+H - Home Tab</p>
<p>Alt+H,C,P - Paste from Clipboard</p>
<p>Alt+H,C,C - Copy</p>
</div>Accessibility Considerations
- Screen Readers: KeyTips should be announced by screen readers
- Keyboard Focus: Ensure visual focus indicators are clear
- WCAG Compliance: KeyTips support WCAG 2.1 Level AA standards
- Alternative Input: Support keyboard-only navigation
- Learning Curve: Provide tooltips showing KeyTip combinations
Common KeyTip Patterns
File Menu: Alt+F
Home Tab: Alt+H
Insert Tab: Alt+I
Design Tab: Alt+D
Clipboard: Alt+H,CD
Copy: Alt+H,CD,C
Paste: Alt+H,CD,P
Font: Alt+H,FB
Font Size: Alt+H,FB,FS
Bold: Alt+H,FB,1Performance Tips
- KeyTips don't significantly impact performance
- Lazy load complex ribbon structures if needed
- Avoid excessive DOM manipulation in KeyTip handlers
- Cache ribbon references for repeated access
Related Components
- Contextual Tabs - KeyTips also apply to contextual tabs
- Backstage View - Support KeyTips for backstage navigation
- File Menu - KeyTips for file operations
- Accessibility - Part of overall accessibility strategy
Ribbon Items: ComboBox, ColorPicker, GroupButton, Template
Table of Contents
ComboBox Items
Basic ComboBox
Dropdown with editable input and data binding:
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.DropDowns
<RibbonItem Type="RibbonItemType.ComboBox">
<RibbonComboBoxSettings DataSource="@fontFamilies"
FieldSettings="@fieldSettings"
AllowFiltering="true">
</RibbonComboBoxSettings>
</RibbonItem>
@code {
private class FontItem
{
public string Text { get; set; }
public string Value { get; set; }
}
private FieldSettingsModel fieldSettings = new FieldSettingsModel
{
Text = "Text",
Value = "Value"
};
private List<FontItem> fontFamilies = new List<FontItem>
{
new FontItem { Text = "Arial", Value = "Arial" },
new FontItem { Text = "Calibri", Value = "Calibri" },
new FontItem { Text = "Cambria", Value = "Cambria" },
new FontItem { Text = "Courier New", Value = "Courier" },
new FontItem { Text = "Times New Roman", Value = "Times" }
};
}ComboBox with Value Binding
Track selected value in component:
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.DropDowns
<div>
<p>Selected Font: @selectedFont</p>
<button @onclick="ApplyFont">Apply Font</button>
</div>
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Font">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.ComboBox">
<RibbonComboBoxSettings @bind-Value="@selectedFont"
DataSource="@fontFamilies"
FieldSettings="@fieldSettings"
AllowFiltering="true"
Index="0">
</RibbonComboBoxSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private string selectedFont = "Arial";
private void ApplyFont()
{
Console.WriteLine($"Applying font: {selectedFont}");
}
private class FontItem
{
public string Text { get; set; }
public string Value { get; set; }
}
private FieldSettingsModel fieldSettings = new FieldSettingsModel
{
Text = "Text",
Value = "Value"
};
private List<FontItem> fontFamilies = new List<FontItem>
{
new FontItem { Text = "Arial", Value = "Arial" },
new FontItem { Text = "Calibri", Value = "Calibri" },
new FontItem { Text = "Cambria", Value = "Cambria" }
};
}ComboBox Events
Handle selection and filtering:
<RibbonComboBoxSettings DataSource="@fontFamilies"
FieldSettings="@fieldSettings"
AllowFiltering="true"
PopupOpening="@OnPopupOpen"
PopupClosed="@OnPopupClosed"
Filtering="@OnFilter"
Selecting="@OnSelect"
ValueChange="@OnValueChange">
</RibbonComboBoxSettings>
@code {
private void OnPopupOpen(ComboBoxPopupOpenEventArgs args)
=> Console.WriteLine("Popup opening");
private void OnPopupClosed(ComboBoxPopupClosedEventArgs args)
=> Console.WriteLine("Popup closed");
private void OnFilter(ComboBoxFilterEventArgs args)
=> Console.WriteLine($"Filtering: {args.Text}");
private void OnSelect(ComboBoxSelectEventArgs args)
=> Console.WriteLine($"Selecting: {args.ItemData}");
private void OnValueChange(ComboBoxChangeEventArgs args)
=> Console.WriteLine($"Value changed: {args.Value}");
}Font Size ComboBox Pattern
Common pattern for size selection:
<RibbonGroup HeaderText="Font" Orientation="Orientation.Row">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<!-- Font Family -->
<RibbonItem Type="RibbonItemType.ComboBox" AllowedSizes="RibbonItemSize.Small">
<RibbonComboBoxSettings @bind-Value="@selectedFont"
DataSource="@fontFamilies"
FieldSettings="@fieldSettings"
AllowFiltering="true"
Placeholder="Font">
</RibbonComboBoxSettings>
</RibbonItem>
<!-- Font Size -->
<RibbonItem Type="RibbonItemType.ComboBox" AllowedSizes="RibbonItemSize.Small">
<RibbonComboBoxSettings @bind-Value="@selectedSize"
DataSource="@fontSizes"
FieldSettings="@fieldSettings"
Index="4"
Placeholder="Size">
</RibbonComboBoxSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
@code {
private string selectedFont = "Arial";
private string selectedSize = "12";
private class ComboItem
{
public string Text { get; set; }
public string Value { get; set; }
}
private FieldSettingsModel fieldSettings = new FieldSettingsModel
{
Text = "Text",
Value = "Value"
};
private List<ComboItem> fontFamilies = new List<ComboItem>
{
new ComboItem { Text = "Arial", Value = "Arial" },
new ComboItem { Text = "Calibri", Value = "Calibri" },
new ComboItem { Text = "Cambria", Value = "Cambria" }
};
private List<ComboItem> fontSizes = new List<ComboItem>
{
new ComboItem { Text = "8", Value = "8" },
new ComboItem { Text = "10", Value = "10" },
new ComboItem { Text = "12", Value = "12" },
new ComboItem { Text = "14", Value = "14" },
new ComboItem { Text = "16", Value = "16" }
};
}ColorPicker Items
Basic ColorPicker
Render a color selection control:
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.Inputs
<RibbonItem Type="RibbonItemType.ColorPicker" AllowedSizes="RibbonItemSize.Small">
<RibbonColorPickerSettings Value="#FF5733">
</RibbonColorPickerSettings>
</RibbonItem>ColorPicker with Value Binding
Track selected color:
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.Inputs
<div>
<p>Selected Color: @selectedColor</p>
<div style="background-color: @selectedColor; width: 50px; height: 50px; border: 1px solid #ccc;"></div>
</div>
<SfRibbon>
<RibbonTabs>
<RibbonTab HeaderText="Home">
<RibbonGroups>
<RibbonGroup HeaderText="Font Color">
<RibbonCollections>
<RibbonCollection>
<RibbonItems>
<RibbonItem Type="RibbonItemType.ColorPicker" AllowedSizes="RibbonItemSize.Small">
<RibbonColorPickerSettings @bind-Value="@selectedColor"
Mode="ColorPickerMode.Picker">
</RibbonColorPickerSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
</RibbonGroups>
</RibbonTab>
</RibbonTabs>
</SfRibbon>
@code {
private string selectedColor = "#FF5733";
}ColorPicker Events
Handle color selection:
<RibbonColorPickerSettings Value="#FF5733"
Mode="ColorPickerMode.Picker"
Created="@OnCreated"
Opening="@OnOpening"
Opened="@OnOpened"
Closing="@OnClosing"
ValueChange="@OnValueChange"
Selected="@OnSelected">
</RibbonColorPickerSettings>
@code {
private void OnCreated() => Console.WriteLine("ColorPicker created");
private void OnOpening(ColorPickerOpenEventArgs args) => Console.WriteLine("Opening");
private void OnOpened(ColorPickerOpenedEventArgs args) => Console.WriteLine("Opened");
private void OnClosing(ColorPickerCloseEventArgs args) => Console.WriteLine("Closing");
private void OnValueChange(ColorPickerEventArgs args) => Console.WriteLine($"Color changed: {args.Value}");
private void OnSelected(ColorPickerSelectedEventArgs args) => Console.WriteLine($"Selected: {args.Value}");
}GroupButton Items
Single Selection GroupButton
Radio button-like behavior:
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<RibbonItem Type="RibbonItemType.GroupButton">
<RibbonGroupButtonSettings Selection="GroupButtonSelection.Single"
Items="@alignmentOptions"
ItemClick="@OnAlignmentClick">
</RibbonGroupButtonSettings>
</RibbonItem>
@code {
private List<GroupButtonItem> alignmentOptions = new List<GroupButtonItem>
{
new GroupButtonItem { IconCss = "e-icons e-align-left", Selected = true, Content = "Left" },
new GroupButtonItem { IconCss = "e-icons e-align-center", Content = "Center" },
new GroupButtonItem { IconCss = "e-icons e-align-right", Content = "Right" },
new GroupButtonItem { IconCss = "e-icons e-justify", Content = "Justify" }
};
private void OnAlignmentClick(GroupButtonClickEventArgs args)
{
Console.WriteLine($"Alignment selected: {args.Item.Content}");
}
}Multiple Selection GroupButton
Checkbox-like behavior:
@using Syncfusion.Blazor.Ribbon
@using Syncfusion.Blazor.SplitButtons
<RibbonItem Type="RibbonItemType.GroupButton">
<RibbonGroupButtonSettings Selection="GroupButtonSelection.Multiple"
HeaderText="Format Styles"
Items="@formatOptions"
ItemClick="@OnFormatClick">
</RibbonGroupButtonSettings>
</RibbonItem>
@code {
private List<GroupButtonItem> formatOptions = new List<GroupButtonItem>
{
new GroupButtonItem { IconCss = "e-icons e-bold", Content = "Bold", Selected = true },
new GroupButtonItem { IconCss = "e-icons e-italic", Content = "Italic" },
new GroupButtonItem { IconCss = "e-icons e-underline", Content = "Underline" },
new GroupButtonItem { IconCss = "e-icons e-strikethrough", Content = "Strikethrough" }
};
private void OnFormatClick(GroupButtonClickEventArgs args)
{
Console.WriteLine($"Format toggled: {args.Item.Content}");
}
}Template Items
Custom HTML Content
Render custom content in ribbon:
@using Syncfusion.Blazor.Ribbon
<RibbonItem Type="RibbonItemType.Template">
<ItemTemplate>
<input type="text" placeholder="Search..."
style="width: 150px; padding: 8px; border: 1px solid #ccc; border-radius: 4px;">
</ItemTemplate>
</RibbonItem>Template with Input Control
Search box example:
@using Syncfusion.Blazor.Ribbon
<RibbonItem Type="RibbonItemType.Template">
<ItemTemplate>
<div style="display: flex; align-items: center;">
<label>Search: </label>
<input @bind="searchText"
type="text"
placeholder="Enter text..."
style="margin-left: 8px; padding: 6px; border: 1px solid #ccc; border-radius: 3px;">
<button @onclick="HandleSearch" style="margin-left: 8px; padding: 6px 12px;">Go</button>
</div>
</ItemTemplate>
</RibbonItem>
@code {
private string searchText = "";
private void HandleSearch()
{
Console.WriteLine($"Searching for: {searchText}");
}
}Template with Rating
Star rating example:
<RibbonItem Type="RibbonItemType.Template">
<ItemTemplate>
<div style="display: flex; gap: 3px;">
@for (int i = 1; i <= 5; i++)
{
int star = i;
<span @onclick="@(() => SetRating(star))"
style="cursor: pointer; font-size: 18px; color: @(rating >= star ? "gold" : "#ccc");">
★
</span>
}
<span style="margin-left: 8px;">@rating/5</span>
</div>
</ItemTemplate>
</RibbonItem>
@code {
private int rating = 3;
private void SetRating(int value)
{
rating = value;
Console.WriteLine($"Rating set to: {value}");
}
}Display Options
Controlling Item Visibility
Show/hide items based on layout:
<!-- Always visible (default) -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Auto">
<RibbonButtonSettings Content="Save"></RibbonButtonSettings>
</RibbonItem>
<!-- Classic layout only -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Classic">
<RibbonButtonSettings Content="Full Options"></RibbonButtonSettings>
</RibbonItem>
<!-- Simplified layout only -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Simplified">
<RibbonButtonSettings Content="Compact"></RibbonButtonSettings>
</RibbonItem>
<!-- Overflow popup only -->
<RibbonItem Type="RibbonItemType.Button" DisplayOptions="DisplayMode.Overflow">
<RibbonButtonSettings Content="Advanced"></RibbonButtonSettings>
</RibbonItem>Advanced Patterns
Font and Size Selection
Combined selector pattern:
<RibbonGroup HeaderText="Font" Orientation="Orientation.Row">
<RibbonCollections>
<RibbonCollection>
<!-- Font Family ComboBox -->
<RibbonItems>
<RibbonItem Type="RibbonItemType.ComboBox" AllowedSizes="RibbonItemSize.Small">
<RibbonComboBoxSettings @bind-Value="@fontFamily"
DataSource="@fonts"
FieldSettings="@fieldSettings"
Index="0">
</RibbonComboBoxSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
<RibbonCollection>
<!-- Font Size ComboBox -->
<RibbonItems>
<RibbonItem Type="RibbonItemType.ComboBox" AllowedSizes="RibbonItemSize.Small">
<RibbonComboBoxSettings @bind-Value="@fontSize"
DataSource="@sizes"
FieldSettings="@fieldSettings"
Index="4">
</RibbonComboBoxSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
<!-- Color and Format -->
<RibbonGroup HeaderText="Formatting">
<RibbonCollections>
<RibbonCollection>
<!-- Font Color -->
<RibbonItems>
<RibbonItem Type="RibbonItemType.ColorPicker" AllowedSizes="RibbonItemSize.Small">
<RibbonColorPickerSettings @bind-Value="@fontColor"
Mode="ColorPickerMode.Picker">
</RibbonColorPickerSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
<RibbonCollection>
<!-- Format Style (GroupButton) -->
<RibbonItems>
<RibbonItem Type="RibbonItemType.GroupButton">
<RibbonGroupButtonSettings Selection="GroupButtonSelection.Multiple"
Items="@formats">
</RibbonGroupButtonSettings>
</RibbonItem>
</RibbonItems>
</RibbonCollection>
</RibbonCollections>
</RibbonGroup>
@code {
private string fontFamily = "Arial";
private string fontSize = "12";
private string fontColor = "#000000";
private class ComboItem
{
public string Text { get; set; }
public string Value { get; set; }
}
private FieldSettingsModel fieldSettings = new FieldSettingsModel
{
Text = "Text",
Value = "Value"
};
private List<ComboItem> fonts = new List<ComboItem>
{
new ComboItem { Text = "Arial", Value = "Arial" },
new ComboItem { Text = "Calibri", Value = "Calibri" },
new ComboItem { Text = "Cambria", Value = "Cambria" }
};
private List<ComboItem> sizes = new List<ComboItem>
{
new ComboItem { Text = "8", Value = "8" },
new ComboItem { Text = "10", Value = "10" },
new ComboItem { Text = "12", Value = "12" },
new ComboItem { Text = "14", Value = "14" },
new ComboItem { Text = "16", Value = "16" }
};
private List<GroupButtonItem> formats = new List<GroupButtonItem>
{
new GroupButtonItem { IconCss = "e-icons e-bold", Content = "B" },
new GroupButtonItem { IconCss = "e-icons e-italic", Content = "I" },
new GroupButtonItem { IconCss = "e-icons e-underline", Content = "U" }
};
}These advanced item types enable rich, interactive ribbon interfaces with data binding and complex UI patterns.