A TabStrip displays a collection of tabs with associated content. It is composed of an unordered list of items - representing tabs - and a collection of div elements, which contain the content for each tab.
<div id="tabStrip">
<ul>
<li>First tab</li>
<li>Second tab</li>
</ul>
<div>First tab content</div>
<div>Second tab content</div>
</div>Initialization of a TabStrip should occur after the DOM is fully loaded. It is recommended that initialization the TabStrip occur within a handler is provided to $(document).ready().
$(document).ready(function() {
$("#tabStrip").kendoTabStrip();
});$(document).ready(function() {
$("#tabstrip").kendoTabStrip({
dataTextField: "text",
dataContentField: "content",
dataSource:
[
{ text: "Tab 1", content: "Tab 1 content" },
{ text: "Tab 2", content: "Tab 2 content" }
]
});
});The tabs of a TabStrip are not required to have content. Should a tab have no content, it is safe to omit its associated div.
While any valid technique for loading AJAX content can be used, a TabStrip supports loading content from URLs in an asynchronous manner. These URLs should return HTML fragments that can be loaded in a TabStrip content area.
<div id="tabstrip">
<ul>
<li>First Tab</li>
<li>Second Tab</li>
</ul>
<div></div>
<div></div>
</div>$(document).ready(function(){
$("#tabstrip").kendoTabStrip({
contentUrls: [null, "html-content-snippet.html"]
});
});The TabStrip API provides several methods for dynamically adding or removing tabs. To add tabs, provide the new item as a JSON object along with a reference item that will be used to determine the placement in the TabStrip. Note: append() does not require a reference item.
A reference item is simply a target DOM element of a tab that already exists in the TabStrip. Any valid selector may be used to obtain a reference to the target item.
Removing an item requires a reference to the target element.
var tabStrip = $("#tabStrip").data("kendoTabStrip");
tabStrip.insertAfter(
{ text: "New Tab" },
tabstrip.tabGroup.children("li:last")
);It is possible to select a tab and display its associated content upon its initial load. There are two (2) ways to accomplish this task:
Both approaches produce the same result.
<div id="tabstrip">
<ul>
<li class="k-state-active">First Tab</li>
<li>Second Tab</li>
</ul>
<div></div>
<div></div>
</div>$(document).ready(function(){
var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
tabstrip.select(tabstrip.tabGroup.children("li:first"));
});$(document).ready(function(){
var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
tabstrip.select(1);
});You can reference an existing TabStrip instance via jQuery.data(). Once a reference has been established, you can use the API to control its behavior.
var tabStrip = $("#tabStrip").data("kendoTabStrip");