.. _dijit/layout/TabContainer-examples:
More TabContainer Examples
==========================
:Status: Draft
:Version: 1.2
Tab Strip
---------
This is a plain TabContainer with three tabs, fixed height and a tab strip. The tabstrip is especially useful when the TabContainer is child of a BorderContainer.
.. cv-compound::
.. cv:: javascript
The html is very simple
.. cv :: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
The doLayout attribute currently only works for top tabs, left/bottom/right tabs don't support it. You can set a tab strip on every tab type though. Following a few examples with left/bottom/right tabs using tabStrip here and there.
Right Tabs
----------
Tabs at the right, no strip
.. cv-compound::
.. cv:: javascript
notice the tabPosition attribute
.. cv :: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
Left Tabs
---------
Tabs at the left, with a strip
.. cv-compound::
.. cv:: javascript
notice the tabPosition attribute
.. cv :: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
Bottom Tabs
-----------
Tabs at the bottom,with a strip
.. cv-compound::
.. cv:: javascript
notice the tabPosition attribute
.. cv :: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
One technique to allow validation, and still use the parser would be to simply decorate the node with a dojoType attribute (after onLoad) and parse the parent node. For ease, we'll store the class name for our inner widgets in a rel="" attribute.
.. cv-compound::
.. cv:: javascript
.. cv :: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
Programmatic Example
--------------------
Here's an example that parses existing DOM and creates tabs,
similar to what the parser does:
.. cv-compound::
As a simple example, we'll use :ref:`dojo.query ` to find and create the ContentPanes used in the TabContainer
.. cv:: javascript
The html is very simple
.. cv:: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
Nested tabs
-----------
Often sites will have two levels of tabs. This is supported by using two TabContainer widgets. Remember that although a TabContainer's children are often ContentPanes, they can be any layout widget, including another TabContainer:
.. cv-compound::
.. cv:: javascript
The html is very simple
.. cv :: html
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
Lorem ipsum and all around...
Lorem ipsum and all around - second...
Lorem ipsum and all around - last...
When you have nested tabs you should set the nested parameter to true, to make the formatting distinctive from the outer TabContainer.