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.
var tabs = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: "Button",
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: "Button",
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: "Button",
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: "DropDown",
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</body>
</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.
var tabs = [{
header: "Home",
groups: [{
collections: [{
items: [{
type: 'SplitButton',
allowedSizes: ej.ribbon.RibbonItemSize.Large,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
content: 'Paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }]
}
}]
}, {
items: [{
type: 'Button',
allowedSizes: ej.ribbon.RibbonItemSize.Medium,
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
allowedSizes: ej.ribbon.RibbonItemSize.Small,
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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.
var fontSize = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
var fontStyle = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
var tabs = [{
header: "Home",
groups: [{
collections: [{
items: [{
type: 'SplitButton',
allowedSizes: ej.ribbon.RibbonItemSize.Large,
splitButtonSettings: {
iconCss: 'e-icons e-paste',
content: 'Paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }]
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
orientation: 'Row',
collections: [{
items: [{
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontStyle,
index: 3,
allowFiltering: true,
width: '150px'
}
}, {
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontSize,
index: 3,
width: '65px'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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.
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
collections: [{
items: [{
type: 'SplitButton',
allowedSizes: ej.ribbon.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: 'Button',
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold',
}
}, {
type: 'Button',
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic',
}
}, {
type: 'Button',
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline',
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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.
var fontSize = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
var fontStyle = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
collections: [{
items: [{
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
groupIconCss: 'e-icons e-bold',
collections: [{
items: [{
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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
.
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
showLauncherIcon: true,
collections: [{
items: [{
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</body>
</html>
Customize launcher icon
You can use the launcherIconCss property to customize the launcher icon by applying the custom styles.
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
showLauncherIcon: true,
collections: [{
items: [{
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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
.
var fontSize = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
var fontStyle = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
collections: [{
items: [{
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
isCollapsible: false,
collections: [{
items: [{
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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.
var fontSize = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
var fontStyle = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
priority: 2,
collections: [{
items: [{
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
groupIconCss: 'e-icons e-bold',
priority: 0,
collections: [{
items: [{
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}, {
header: 'Editing',
groupIconCss: 'e-icons e-edit',
priority: 1,
collections: [{
items: [{
type: '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: 'Button',
buttonSettings: {
content: 'Replace',
iconCss: 'e-icons e-replace'
}
}, {
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-mouse-pointer',
items: [
{ text: 'Select All' },
{ text: 'Select Objects' }
],
content: 'Select'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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.
var tabs = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: "Button",
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: "Button",
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: "Button",
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: "DropDown",
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</body>
</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
.
var fontSize = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '24', '26', '28', '36', '48', '72', '96'];
var fontStyle = ['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Courier New', 'Candara', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Windings'
];
var tabs = [{
header: "Home",
groups: [{
header: 'Clipboard',
groupIconCss: 'e-icons e-paste',
collections: [{
items: [{
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-paste',
items: [{ text: 'Keep Source Format' }, { text: 'Merge format' }, { text: 'Keep text only' }],
content: 'Paste'
}
}]
}, {
items: [{
type: 'Button',
buttonSettings: {
content: 'Cut',
iconCss: 'e-icons e-cut'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Copy',
iconCss: 'e-icons e-copy'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Format Painter',
iconCss: 'e-icons e-format-painter'
}
}]
}]
}, {
header: 'Font',
groupIconCss: 'e-icons e-bold',
orientation: 'Row',
enableGroupOverflow: true,
collections: [{
items: [{
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontStyle,
index: 3
}
}, {
type: 'ComboBox',
comboBoxSettings: {
dataSource: fontSize,
index: 3
}
}]
}, {
items: [{
type: 'ColorPicker',
allowedSizes: ej.ribbon.RibbonItemSize.Small,
colorPickerSettings: {
value: '#123456'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Bold',
iconCss: 'e-icons e-bold'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Italic',
iconCss: 'e-icons e-italic'
}
}, {
type: 'Button',
buttonSettings: {
content: 'Underline',
iconCss: 'e-icons e-underline'
}
}]
}]
}, {
header: 'Editing',
groupIconCss: 'e-icons e-edit',
collections: [{
items: [{
type: '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: 'Button',
buttonSettings: {
content: 'Replace',
iconCss: 'e-icons e-replace'
}
}, {
type: 'SplitButton',
splitButtonSettings: {
iconCss: 'e-icons e-mouse-pointer',
items: [
{ text: 'Select All' },
{ text: 'Select Objects' }
],
content: 'Select'
}
}]
}]
}]
}];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
.ribbonTemplate {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.ribbonTemplate.Large {
flex-direction: column;
}
.ribbonTemplate.Large .e-icons {
font-size: 35px;
}
.ribbonTemplate.Medium .e-icons,
.ribbonTemplate.Small .e-icons{
font-size: 20px;
margin: 15px 5px;
}
.ribbonTemplate.Small .text {
display:none;
}
.font-group .e-ribbon-group-content {
justify-content: center;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</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
.
var tabs = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: "Button",
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: "Button",
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: "Button",
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: "DropDown",
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}
]
}
];
var ribbon = new ej.ribbon.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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</body>
</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
.
var tabs = [
{
header: "Home",
groups: [
{
header: "Clipboard",
collections: [
{
items: [
{
type: "Button",
buttonSettings: {
content: "Paste",
iconCss: "e-icons e-paste",
}
},
],
},
{
items: [
{
type: "Button",
buttonSettings: {
content: "Cut",
iconCss: "e-icons e-cut",
}
},
{
type: "Button",
buttonSettings: {
content: "Copy",
iconCss: "e-icons e-copy",
}
},
],
}
]
}
]
},
{
header: "Insert",
groups: [
{
header: "Tables",
collections: [{
items: [{
type: "DropDown",
dropDownSettings: {
iconCss: "e-icons e-table",
content: "Table",
items: [
{ text: "Insert Table" }, { text: "Draw Table" },
{ text: "Convert Table" }, { text: "Excel SpreadSheet" }
]
}
}]
}]
}]
}
];
var ribbon = new ej.ribbon.Ribbon({
tabs: tabs,
hideLayoutSwitcher: false
});
ribbon.appendTo("#ribbon");
var updateLayoutSwitcher = new ej.buttons.CheckBox({ label: 'Show/Hide Layout Switcher', checked: true, change: onChangeSwitcher });
updateLayoutSwitcher.appendTo('#checkbox1');
function onChangeSwitcher(args) {
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/29.1.33/ej2-base/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-buttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-popups/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-splitbuttons/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-inputs/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-lists/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-navigations/styles/material.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/29.1.33/ej2-ribbon/styles/material.css" rel="stylesheet">
<!--system js reference and configuration-->
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<style>
#ribbon {
margin-top: 30px;
}
</style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<input id="checkbox1" type="checkbox">
<div id="ribbon"></div>
</div>
<script src="index.js" type="text/javascript"></script>
</body>
</html>