Properties Methods Events Config Options Direct Link
Observable
  Component
    BoxComponent
      Container
        Panel
          TabPanel

Class Ext.TabPanel

Package:Ext
Defined In:TabPanel.js
Class:TabPanel
Extends:Panel

A basic tab container. Tab panels can be used exactly like a standard Ext.Panel for layout purposes, but also have special support for containing child Panels that get automatically converted into tabs.

There is no actual tab class — each tab is simply an Ext.Panel. However, when rendered in a TabPanel, each child Panel can fire additional events that only exist for tabs and are not available to other Panels. These are:

There are several methods available for creating TabPanels. The output of the following examples should be exactly the same. The tabs can be created and rendered completely in code, as in this example:


var tabs = new Ext.TabPanel({
    renderTo: Ext.getBody(),
    activeTab: 0,
    items: [{
        title: 'Tab 1',
        html: 'A simple tab'
    },{
        title: 'Tab 2',
        html: 'Another one'
    }]
});

TabPanels can also be rendered from markup in a couple of ways. See the autoTabs example for rendering entirely from markup that is already structured correctly as a TabPanel (a container div with one or more nested tab divs with class 'x-tab'). You can also render from markup that is not strictly structured by simply specifying by id which elements should be the container and the tabs. Using this method, tab content can be pulled from different elements within the page by id regardless of page structure. Note that the tab divs in this example contain the class 'x-hide-display' so that they can be rendered deferred without displaying outside the tabs. You could alternately set deferredRender to false to render all content tabs on page load. For example:


var tabs = new Ext.TabPanel({
    renderTo: 'my-tabs',
    activeTab: 0,
    items:[
        {contentEl:'tab1', title:'Tab 1'},
        {contentEl:'tab2', title:'Tab 2'}
    ]
});

// Note that the tabs do not have to be nested within the container (although they can be)
<div id="my-tabs"></div>
<div id="tab1" class="x-hide-display">A simple tab</div>
<div id="tab2" class="x-hide-display">Another one</div>

Config Options

Config Options Defined By
  activeTab : String/Number
A string id or the numeric index of the tab that should be initially activated on render (defaults to none).
TabPanel
  allowDomMove : Boolean
Whether the component can move the Dom node when rendering (defaults to true).
Component
  autoHeight : Boolean
True to use height:'auto', false to use fixed height (defaults to false).
BoxComponent
  autoWidth : Boolean
True to use width:'auto', false to use fixed width (defaults to false).
BoxComponent
  baseCls : String
The base CSS class applied to the panel (defaults to 'x-tab-panel').
TabPanel
  buttonAlign : String
The alignment of any buttons added to this panel. Valid values are 'right,' 'left' and 'center' (defaults to 'right').
Panel
  buttons : Array
An array of Ext.Button configs used to add buttons to the footer of this panel.
Panel
  collapsed : Boolean
True to render the panel collapsed, false to render it expanded (defaults to false).
Panel
  collapsedCls : String
A CSS class to add to the panel's element after it has been collapsed (defaults to 'x-panel-collapsed').
Panel
  contentEl : String
The id of an existing HTML node to use as the panel's body content (defaults to '').
Panel
  defaultType : String
The default type of container represented by this object as registered in Ext.ComponentMgr (defaults to 'panel').
Container
  disabledClass : String
CSS class added to the component when it is disabled (defaults to "x-item-disabled").
Component
  frame : Boolean
True to render the panel with custom rounded borders, false to render with plain 1px square borders (defaults to false).
Panel
  height : Number
The height of this component in pixels (defaults to auto).
BoxComponent
  hideCollapseTool : Boolean
True to hide the expand/collapse toggle button when collapsible = true, false to display it (defaults to false).
Panel
  html : String/Object
An HTML fragment, or a DomHelper specification to use as the panel's body content (defaults to '').
Panel
  iconCls : String
A CSS class that will provide a background image to be used as the panel header icon (defaults to '').
Panel
  id : String
The unique id of this component (defaults to an auto-assigned id).
Component
  layoutOnTabChange : Boolean
Set to true to do a layout of tab items as tabs are changed.
TabPanel
  minButtonWidth : Number
Minimum width in pixels of all buttons in this panel (defaults to 75)
Panel
  minTabWidth : Number
The minimum width in pixels for each tab when resizeTabs = true (defaults to 30).
TabPanel
  monitorResize : Boolean
True to automatically monitor window resize events and rerender the layout on browser resize (defaults to true).
TabPanel
  plain : Boolean
True to render the tab strip without a background container image (defaults to false).
TabPanel
  scrollRepeatInterval : Number
Number of milliseconds between each scroll while a tab scroll button is continuously pressed (defaults to 400).
TabPanel
  stateId : String
The unique id for this component to use for state management purposes (defaults to the component id).
Component
  tabWidth : Number
The initial width in pixels of each new tab (defaults to 120).
TabPanel
  wheelIncrement : Number
For scrolling tabs, the number of pixels to increment on mouse wheel scrolling (defaults to 20).
TabPanel
  width : Number
The width of this component in pixels (defaults to auto).
BoxComponent

Public Properties

Property Defined By
  buttons : Array
This Panel's Array of buttons as created from the buttons config property. Read only.
Panel
  disabled : Boolean
True if this component is disabled. Read-only.
Component
  footer : Ext.Element
The Panel's footer Element. Read-only.

This Element is used to house the Panel's buttons.

Panel
  hidden : Boolean
True if this component is hidden. Read-only.
Component
  initialConfig : Object
This Component's initial configuration specification. Read-only.
Component
  items : MixedCollection
The collection of components in this container as a Ext.util.MixedCollection
Container
  rendered : Boolean
True if this component has been rendered. Read-only.
Component

Public Methods

Method Defined By

Public Events

Event Defined By