Template configuration in EJ2 TypeScript Toolbar control
20 Dec 202421 minutes to read
The JavaScript Toolbar can be rendered by item based collection and by HTML elements. To render it based on the given HTML element, use id
as the target
property. To render the Toolbar, follow the below structure of the HTML elements:
<div id='template_toolbar'> --> Root Toolbar Element
<div> --> Toolbar Items Container
<div> --> Toolbar Item Element
</div>
</div>
</div>
Here, the template ID, #template_toolbar
is directly appended to the Toolbar.
import {Toolbar} from '@syncfusion/ej2-navigations';
let toolbar: Toolbar = new Toolbar();
toolbar.appendTo('#template_toolbar');
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 Toolbar</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Toolbar Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/material.css" rel="stylesheet" />
<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='template_toolbar'>
<div>
<div><button class='e-btn e-tbar-btn'>Cut</button> </div>
<div><button class='e-btn e-tbar-btn'>Copy</button> </div>
<div><button class='e-btn e-tbar-btn'>Paste</button> </div>
<div class='e-separator'> </div>
<div><button class='e-btn e-tbar-btn'>Bold</button> </div>
<div><button class='e-btn e-tbar-btn'>Italic</button> </div>
</div>
</div>
<br/><br/>
<div id='result'></div>
</div>
</body>
</html>
Popup customization
Popup
is one of the supported responsive modes of the Toolbar. The Toolbar commands, popup mode priority and button text mode customizations are achieved in the item based rendering through property declaration. For more information on popup mode, refer here.
The above behavior can also be achieved with template rendering by defining equivalent class
names instead of property declaration.
Equivalent class names listed below are needed to add the Toolbar items div
element.
Priority
Class | Description |
---|---|
e-overflow-show | Commands are always displayed on the Toolbar with primary priority. |
e-overflow-hide | Commands are always displayed in the popup with secondary priority. |
Button text mode
Class | Description |
---|---|
e-popup-text | Button text is only visible in the Popup . |
e-toolbar-text | Button text is only visible on the Toolbar . |
import {Toolbar} from '@syncfusion/ej2-navigations';
let toolbar: Toolbar = new Toolbar({ width: 250 , overflowMode: 'Popup' });
toolbar.appendTo('#template_toolbar');
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 Toolbar</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Toolbar Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/material.css" rel="stylesheet" />
<link href="https://ej2.syncfusion.com/angular/demos/src/toolbar/toolbar.component.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
@font-face {
font-family: "Material_toolbar";
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj1tShMAAAEoAAAAVmNtYXDoMOjqAAACDAAAAHhnbHlmIuy19QAAAswAACNMaGVhZA6okZMAAADQAAAANmhoZWEIUQQkAAAArAAAACRobXR4jAAAAAAAAYAAAACMbG9jYYc0kUIAAAKEAAAASG1heHABOwG8AAABCAAAACBuYW1lx/RZbQAAJhgAAAKRcG9zdJZeEVUAACisAAACGAABAAAEAAAAAFwEAAAAAAAD9AABAAAAAAAAAAAAAAAAAAAAIwABAAAAAQAAAQsu/F8PPPUACwQAAAAAANXLJlEAAAAA1csmUQAAAAAD9AP0AAAACAACAAAAAAAAAAEAAAAjAbAADgAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQAAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5wDnIQQAAAAAXAQAAAAAAAABAAAAAAAABAAAAAQAAAAEAAAABAAAA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VudV8wMDEHQ3V0XzAwMghCb2xkXzAwMRFBbGlnbl9KdXN0aWZ5XzAwMQpSZWxvYWRfMDAxClNlYXJjaF8wMDEKVXBsb2FkXzAwMQpEZXNpZ25fMDA1CkV4cG9ydF8wMDEIQ29weV8wMDIAAA==) format("truetype");
font-weight: normal;
font-style: normal;
}
.e-bigger .e-tbar-btn .tb-icons {
font-size: 18px;
}
.e-tbar-btn .tb-icons {
font-family: "Material_toolbar";
speak: none;
font-size: 16px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
}
.e-cut-icon:before {
content: "\e719";
}
.e-copy-icon:before {
content: "\e721";
}
.e-paste-icon:before {
content: "\e712";
}
.e-color-icon:before {
content: "\e703";
}
.e-bold-icon:before {
content: "\e71a";
}
.e-underline-icon:before {
content: "\e706";
}
.e-clear-icon:before {
content: "\e70d";
}
.e-italic-icon:before {
content: "\e710";
}
.e-ascending-icon:before {
content: "\e70f";
}
.e-descending-icon:before {
content: "\e707";
}
</style>
<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='template_toolbar'>
<div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-cut-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Cut</div></button> </div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-copy-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Copy</div></button> </div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-paste-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Paste</div></button> </div>
<div class='e-separator'> </div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-bold-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Bold</div></button> </div>
<div class='e-overflow-hide e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-underline-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Underline</div></button> </div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-italic-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Italic</div></button> </div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-ascending-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">A-Z Sort</div></button> </div>
<div class='e-overflow-show e-popup-text'><button class='e-btn e-tbar-btn'><span class="e-descending-icon tb-icons e-icons e-btn-icon"></span><div class="e-tbar-btn-text">Z-A Sort</div></button> </div>
</div>
</div>
<br/><br/>
<div id='result'></div>
</div>
</body>
</html>
Integrate menu component
You can integrate menu component as toolbar item in Toolbar using template
property. Menu can be populated with items as needed.
import { Toolbar,Menu,MenuItemModel } from '@syncfusion/ej2-navigations';
let menuTemplate: string = '<ul id="menu"></ul>';
let data: MenuItemModel[] = [
{
text: 'Appliances',
items: [
{
text: 'Kitchen',
items: [
{ text: 'Electric Cookers' },
{ text: 'Coffee Makers' },
{ text: 'Blenders' },
],
},
{
text: 'Washing Machine',
items: [{ text: 'Fully Automatic' }, { text: 'Semi Automatic' }],
},
{
text: 'Air Conditioners',
items: [
{ text: 'Inverter ACs' },
{ text: 'Split ACs' },
{ text: 'Window ACs' },
],
},
],
},
{
text: 'Accessories',
items: [
{
text: 'Mobile',
items: [
{ text: 'Headphones' },
{ text: 'Memory Cards' },
{ text: 'Power Banks' },
],
},
{
text: 'Computer',
items: [
{ text: 'Pendrives' },
{ text: 'External Hard Disks' },
{ text: 'Monitors' },
],
},
],
},
{
text: 'Fashion',
items: [
{
text: 'Men',
items: [
{ text: 'Shirts' },
{ text: 'Jackets' },
{ text: 'Track Suits' },
],
},
{
text: 'Women',
items: [{ text: 'Kurtas' }, { text: 'Salwars' }, { text: 'Sarees' }],
},
],
},
{
text: 'Home & Living',
items: [
{
text: 'Furniture',
items: [
{ text: 'Beds' },
{ text: 'Mattresses' },
{ text: 'Dining Tables' },
],
},
{
text: 'Decor',
items: [
{ text: 'Clocks' },
{ text: 'Wall Decals' },
{ text: 'Paintings' },
],
},
],
},
];
let toolbarObj: Toolbar = new Toolbar({
items: [
{ text: "Cut" },
{ text: "Copy" },
{ template: menuTemplate },
{ text: "Paste" }
],
});
toolbarObj.appendTo('#element');
let menuObj: Menu = new Menu({items: data,},'#menu');
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 Toolbar</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Toolbar Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/material.css" rel="stylesheet" />
<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='element'></div>
</div>
</body>
</html>