Ribbon Layouts
10 May 202424 minutes to read
The Ribbon allows to customize the layout by using the activeLayout property. The Ribbon component supports the following layouts:
Classic layout
In classic layout, the Ribbon component organizes the items and groups in a traditional form by setting the activeLayout property to Classic. By default, the Ribbon component renders in the Classic
layout.
import { Ribbon, RibbonTabModel, RibbonItemType } from "@syncfusion/ej2-ribbon";
let tabs: RibbonTabModel[] = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: RibbonItemType.DropDown,
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
let ribbon: Ribbon = new Ribbon({
tabs: tabs,
activeLayout: "Classic"
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
<style>
#container {
visibility: hidden;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</html>
Defining items size
You can use the allowedSizes property to set the allowed size for an item. The Ribbon items can be appeared in three different sizes: Large(large icon with text), Medium(small icon with text) and Small(small icon only). On resizing, the items size can be changed based on the available width of the tab content from the order of Large-> Medium-> Small and viceversa.
import { Ribbon, RibbonItemSize, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
collections: [{
items: [{
type: RibbonItemType.SplitButton,
allowedSizes: RibbonItemSize.Large,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
allowedSizes: RibbonItemSize.Medium,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
allowedSizes: RibbonItemSize.Small,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Defining items orientation
The Ribbon group orientation property allows to manage how the items are aligned either in a Row
or Column
. By default, the orientation is set to Column
, in which the items are arranged vertically.
import { Ribbon, ItemOrientation, RibbonItemSize, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let fontSize: string[] = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
let fontStyle: string[] = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
collections: [{
items: [{
type: RibbonItemType.SplitButton,
allowedSizes: RibbonItemSize.Large,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
orientation: ItemOrientation.Row,
collections: [{
items: [{
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontStyle,
index: 3,
allowFiltering: true,
width: '150px'
}
}, {
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontSize,
index: 3,
width: '65px'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
When the orientation is set to
Row
a group may have a maximum of three collections each of which may contain any number of items. When the orientation is set toColumn
a group may have any number of collections, each of which may contain one large-sized item or three medium/small-sized items. If two large-sized items are specified, it automatically converts into two medium/small-sized items.
Defining group header
You can use the header property to set the name for each group header.
import { Ribbon, RibbonItemSize, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let tabs: RibbonTabModel[] = [{
header: 'Home',
groups: [{
header: 'Clipboard',
collections: [{
items: [{
type: RibbonItemType.SplitButton,
allowedSizes: RibbonItemSize.Large,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [
{ text: 'Keep Source Format' },
{ text: 'Merge format' },
{ text: 'Keep text only' },
],
content: 'Paste',
}
}]
}]
},
{
header: 'Font',
collections: [{
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold',
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic',
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline',
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Defining group icon
You can use the groupIconCss property to customize the icons in the group overflow button. When the ribbon size is adjusted, the group popup will appear.
import { Ribbon, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let fontSize: string[] = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
let fontStyle: string[] = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
groupIconCss: 'e-icons e-bold',
collections: [{
items: [{
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Enabling group launcher icon
You can use the showLauncherIcon property to enable or disable the launcher icon for each group. By default, the property is set to false
.
import { Ribbon, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
header: 'Clipboard',
showLauncherIcon: true,
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Customize launcher icon
You can use the launcherIconCss property to customize the launcher icon by applying the custom styles.
import { Ribbon, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
header: 'Clipboard',
showLauncherIcon: true,
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
launcherIconCss: 'e-icons e-description',
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Defining group collapsible state
You can use the isCollapsible property to determine whether the group is collapsed or not during resize. By default, the property is set to true
. To prevent the group from being collapsed, set the property to false
.
import { Ribbon, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let fontSize: string[] = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
let fontStyle: string[] = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
isCollapsible: false,
collections: [{
items: [{
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Defining priority order for group collapse or expand
You can use the priority property to set the priority order for each group which should be collapsed or expanded on resizing. When collapsing, higher priority values are fetched first. When expanding, lower priority values are fetched first.
import { Ribbon, RibbonItemType, RibbonTabModel } from '@syncfusion/ej2-ribbon';
let fontSize: string[] = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
let fontStyle: string[] = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
priority: 2,
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
groupIconCss: 'e-icons e-bold',
priority: 0,
collections: [{
items: [{
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}, {
header: 'Editing',
groupIconCss: 'e-icons e-edit',
priority: 1,
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-search',
items: [
{ text: 'Find', iconCss: 'e-icons e-search' },
{ text: 'Advanced find', iconCss: 'e-icons e-search' },
{ text: 'Go to', iconCss: 'e-icons e-arrow-right' }
],
content: 'Find'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Replace',
iconCss: 'e-icons e-replace'
}
}, {
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-mouse-pointer',
items: [
{ text: 'Select All' },
{ text: 'Select Objects' }
],
content: 'Select'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Simplified layout
In simplified layout, the Ribbon component organizes the items and groups into a single row by setting the activeLayout property to Simplified.
import { Ribbon, RibbonTabModel, RibbonItemType } from "@syncfusion/ej2-ribbon";
let tabs: RibbonTabModel[] = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: RibbonItemType.DropDown,
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
let ribbon: Ribbon = new Ribbon({
tabs: tabs,
activeLayout: "Simplified"
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
<style>
#container {
visibility: hidden;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</html>
Enabling group overflow popup
You can use the enableGroupOverflow property to add a separate popup for the overflow items in the group while resizing. The overflow items will appear in the common overflow popup, located at the right end of the tab content if it is set to false
.
import { Ribbon, RibbonItemType, RibbonTabModel, RibbonItemSize, ItemOrientation, RibbonColorPicker } from '@syncfusion/ej2-ribbon';
Ribbon.Inject(RibbonColorPicker);
let fontSize: string[] = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
let fontStyle: string[] = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
let tabs: RibbonTabModel[] = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: RibbonItemType.Button,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
groupIconCss: 'e-icons e-bold',
orientation: ItemOrientation.Row,
enableGroupOverflow: true,
collections: [{
items: [{
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: RibbonItemType.ComboBox,
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: RibbonItemType.ColorPicker,
allowedSizes: RibbonItemSize.Small,
colorPickerSettings: {
value: '#123456'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}, {
header: 'Editing',
groupIconCss: 'e-icons e-edit',
priority: 1,
collections: [{
items: [{
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-search',
items: [
{ text: 'Find', iconCss: 'e-icons e-search' },
{ text: 'Advanced find', iconCss: 'e-icons e-search' },
{ text: 'Go to', iconCss: 'e-icons e-arrow-right' }
],
content: 'Find'
}
}, {
type: RibbonItemType.Button,
buttonSettings: {
content: 'Replace',
iconCss: 'e-icons e-replace'
}
}, {
type: RibbonItemType.SplitButton,
splitButtonSettings: {
iconCss: 'e-icons e-mouse-pointer',
items: [
{ text: 'Select All' },
{ text: 'Select Objects' }
],
content: 'Select'
}
}]
}]
}]
}];
let ribbon: Ribbon = new Ribbon({
activeLayout: 'Simplified',
tabs: tabs
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
</html>
Minimized State
You can hide the Ribbon contents and display only the tab headers by double-clicking on the tab header. In minimized state, the Ribbon control expands to its normal state when click on the tab header.
You can use the isMinimized property to change the Ribbon component to minimized state. By default, the value is false
.
import { Ribbon, RibbonTabModel, RibbonItemType } from "@syncfusion/ej2-ribbon";
let tabs: RibbonTabModel[] = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: RibbonItemType.DropDown,
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
let ribbon: Ribbon = new Ribbon({
tabs: tabs,
isMinimized: true
});
ribbon.appendTo("#ribbon");
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div id="ribbon"></div>
</div>
</body>
<style>
#container {
visibility: hidden;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</html>
Show or hide the layout switcher
You can use the hideLayoutSwitcher property to show/hide the Ribbon layout switcher button. By default, the value is false
.
import { Ribbon, RibbonTabModel, RibbonItemType } from "@syncfusion/ej2-ribbon";
import { ChangeEventArgs, CheckBox } from '@syncfusion/ej2-buttons';
let tabs: RibbonTabModel[] = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: RibbonItemType.Button,
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]}
]},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: RibbonItemType.DropDown,
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
let ribbon: Ribbon = new Ribbon({
tabs: tabs,
hideLayoutSwitcher: false
});
ribbon.appendTo("#ribbon");
let updateLayoutSwitcher: CheckBox = new CheckBox({ label: 'Show/Hide Layout Switcher', checked: true, change: onChangeSwitcher });
updateLayoutSwitcher.appendTo('#checkbox1');
function onChangeSwitcher(args: ChangeEventArgs): void {
ribbon.hideLayoutSwitcher = !args.checked;
}
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Essential JS 2 - Ribbon</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-ribbon/styles/material.css" rel="stylesheet" />
<!--system js reference and configuration-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<input id="checkbox1" type="checkbox">
<div id="ribbon"></div>
</div>
</body>
<style>
#container {
visibility: hidden;
}
#ribbon {
margin-top: 30px;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</html>