Load tab items dynamically in EJ2 JavaScript Tab control

2 May 202311 minutes to read

Tabs can be added dynamically by passing array of items and index value to the addTab method.

    // New tab title and content inputs are fetched and stored in local variable
    let title: string = document.getElementById('tab-title').value;
    let content: string = document.getElementById('tab-content').value;

    // Required tab item object formed by using textbox inputs
    let item: Object =  { header: { text: title }, content: createElement('pre', { innerHTML: content.replace(/\n/g, '<br>\n') }).outerHTML };

    // Item object and the index argument passed into the addTab method to add a new tab
    tabObj.addTab([item], index);

In the following demo, you can add the tab content by clicking the +. This + icon is added on the tab header using iconCss property. Enter the new Tab heading and content details in the available text boxes, click ‘Add Tab’ button to pass the details as an array and here last index is calculated to append the new tab at the end.

ej.base.enableRipple(true);

var totalItems = 0;

//Initialize Tab component
var tabObj = new ej.navigations.Tab({
    selected: tabSelected,
    items: [
        {
            header: { 'text': 'Twitter' },
            content: '#tab1_content'
        },
        {
            header: { 'iconCss': 'e-add-icon' },
            content: '#form-container'
        }
    ]
  });
//Render initialized Tab component
tabObj.appendTo('#element');

var addBtn = document.querySelectorAll(".e-ileft.e-icon");
addBtn[0].setAttribute("title", "Add Tab");

function tabSelected(args) {
    if (args.selectedIndex === document.querySelectorAll('#element .e-toolbar-item').length -1) {
        document.getElementById('tab-title').value = '';
        document.getElementById('tab-content').value = '';
    }
}

document.getElementById('btn-add').onclick = function(e) {
    var title = document.getElementById('tab-title').value;
    var content = document.getElementById('tab-content').value;
    // Required tab item object formed by using textbox inputs
    var item = { header: { text: title }, content: ej.base.createElement('pre', { innerHTML: content.replace(/\n/g, '<br>\n') }).outerHTML };

    totalItems = document.querySelectorAll('#element .e-toolbar-item').length;
    // Item object and the index argument passed into the addTab method to add a new tab
    tabObj.addTab([item], totalItems-1);
};
<!DOCTYPE html><html lang="en"><head>
    <title>Essential JS 2 Tab</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Essential JS 2 Tab">
    <meta name="author" content="Syncfusion">
    <link href="https://cdn.syncfusion.com/ej2/28.1.33/material.css" rel="stylesheet">
    <link href="index.css" rel="stylesheet">
    <script src="https://cdn.syncfusion.com/ej2/28.1.33/dist/ej2.min.js" type="text/javascript"></script>
    <style>
        @font-face {
          font-family: 'Socialicons';
          src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMv1tCfsAAAEoAAAAVmNtYXCnKKeOAAABrAAAAEhnbHlml19XagAAAgwAABhQaGVhZA8dCeEAAADQAAAANmhoZWEIUQQMAAAArAAAACRobXR4LAAAAAAAAYAAAAAsbG9jYR3AIwwAAAH0AAAAGG1heHABIAIAAAABCAAAACBuYW1l0X1q/wAAGlwAAAJVcG9zdGX5D00AABy0AAAAkwABAAAEAAAAAFwEAAAAAAAD9AABAAAAAAAAAAAAAAAAAAAACwABAAAAAQAA+iTiP18PPPUACwQAAAAAANYFYngAAAAA1gVieAAAAAAD9AP0AAAACAACAAAAAAAAAAEAAAALAfQACwAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQAAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABApwCnCQQAAAAAXAQAAAAAAAABAAAAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADQAAAAEAAQAAQAApwn//wAApwD//wAAAAEABAAAAAEAAgADAAQABQAGAAcACAAJAAoAAAAAAiQCzgOMBU4F/gZYB9QIcAo+DCgABAAAAAAD0gPzAFUA4gF3AfMAAAEzHwYHFQ8EFR8IPwUfBRUPCCMvFj0BPwoXNw8fHQEfDhUPAT8CHwkzPyA9Ai8iDwIFHwcPIysBLwYjDwI/AS8PNT8oHx4BDxAdAR8PHQEHPwE7AR8EMz8dNS8kIw8FAYkFEgQDAyQDAQECAyIBAQMSEgkUCw4vBQQFChsGBQdqAgIBAwMDCAoMDA0NBgYPEA8PFxYVFBQ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QBjAG8AbgBzAFIAZQBnAHUAbABhAHIAUwBvAGMAaQBhAGwAaQBjAG8AbgBzAFMAbwBjAGkAYQBsAGkAYwBvAG4AcwBWAGUAcgBzAGkAbwBuACAAMQAuADAAUwBvAGMAaQBhAGwAaQBjAG8AbgBzAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAHUAcwBpAG4AZwAgAFMAeQBuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsBAgEDAQQBBQEGAQcBCAEJAQoBCwEMAAh3aGF0c2FwcAd0d2l0dGVyBXZpbWVvCWluc3RhZ3JhbQhsaW5rZWRpbghmYWNlYm9vawtnb29nbGUtcGx1cwZ0dW1ibHIIc2t5cGUtMDEIeW91dHViZTEAAAA=) format('truetype');
          font-weight: normal;
          font-style: normal;
        }
    
        .e-add-icon::before {
          content: '\e823';
        }

        .e-content .e-item {
            font-size: 12px;
            margin: 10px;
            text-align: justify;
        }

        .container {
            min-width: 350px;
            max-width: 500px;
            margin: 0 auto;
        }

        #form-container {
            margin: 0 auto;
            max-width: 300px;
        }

        .btn-section {
            text-align: center;
        }

        .add-tab-btn-section td {
            padding: 10px;
        }

        .info {
            font-weight: bold;
        }
    </style>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="tab1_content" style="display: none">
            <ul>
                <li>Click on the "+" header to add dynamic tab items. </li>
                <li>It displays input elements to get the new tab information. </li>
                <li>Add details and click the "Add Tab" button to open the newly added tab.</li>
            </ul>
        </div>
        <div id="form-container" style="display: none">
            <div class="e-float-input">
                <input type="text" id="tab-title" required="">
                <span class="e-float-line"></span>
                <label class="e-float-text">Enter header title</label>
            </div>
            <br>
            <div class="e-float-input">
                <textarea rows="5" type="text" id="tab-content" required=""></textarea>
                <span class="e-float-line"></span>
                <label class="e-float-text">Enter content</label>
            </div>
            <br>
            <div class="btn-section">
                <button id="btn-add" class="e-btn">Add Tab</button>
                <br>
                <br>
                <span class="info"> * Title is mandatory to add a new Tab</span>
            </div>
        </div>
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>