# Yahoo! UI Library

### tabview 2.8.2r1

Yahoo! UI Library > tabview > YAHOO.widget.TabView
Search:
Filters
Show Private Show Protected Show Deprecated

## Class YAHOO.widget.TabView - extends YAHOO.util.Element

A widget to control tabbed views.

### Constructor

YAHOO.widget.TabView `( el(optional) , attr )`

Parameters:
  `el(optional) <HTMLElement | String | Object>` The html element that represents the TabView, or the attribute object to use. An element will be created if none provided.
  `attr <Object>` (optional) A key map of the tabView's initial attributes. Ignored if first arg is attributes object.

### Properties

#### _contentParent - `private HTMLElement`

The container of the tabView's content elements.

#### _tabParent - `private HTMLElement`

The container of the tabView's label elements.

#### CLASSNAME - `object`

The className to add when building from scratch.
Default Value: "navset"

#### CONTENT_PARENT_CLASSNAME - `object`

The className of the HTMLElement containing the TabView's label elements to look for when building from existing markup, or to add when building from scratch. All childNodes of the content container are treated as content elements when building from existing markup.
Default Value: "nav-content"

#### TAB_PARENT_CLASSNAME - `object`

The className of the HTMLElement containing the TabView's tab elements to look for when building from existing markup, or to add when building from scratch. All childNodes of the tab container are treated as Tabs when building from existing markup.
Default Value: "nav"

#### Properties inherited from YAHOO.util.Element:

`DOM_EVENTS`

#### Properties inherited from YAHOO.util.AttributeProvider:

`_configs`

#### Properties inherited from YAHOO.util.EventProvider:

`__yui_events, __yui_subscribers`

### Methods

#### _initTabs

`private _initTabs ( )`
Creates Tab instances from a collection of HTMLElements.

Returns: ``
  void

#### addTab

`addTab ( tab , index )`
Adds a Tab to the TabView instance. If no index is specified, the tab is added to the end of the tab list.

Parameters:
  `tab <YAHOO.widget.Tab>` A Tab instance to add.
  `index <Integer>` The position to add the tab.

Returns: ``
  void

#### contentTransition

`void contentTransition ( )`
The transiton to use when switching between tabs.

#### deselectTab

`void deselectTab ( index )`
Removes selected state from the given tab if it is the activeTab

Parameters:
  `index <Int>` The tab index to deselect

#### DOMEventHandler

`DOMEventHandler ( e )`
Routes childNode events.

Parameters:
  `e <event>` The Dom event that is being handled.

Returns: ``
  void

#### getTab

`getTab ( index )`
Returns the Tab instance at the specified index.

Parameters:
  `index <Integer>` The position of the Tab.

Returns: ``
  YAHOO.widget.Tab

#### getTabIndex

`getTabIndex ( tab )`
Returns the index of given tab.

Parameters:
  `tab <YAHOO.widget.Tab>` The tab whose index will be returned.

Returns: ``
  int

#### initAttributes

`void initAttributes ( attr )`
setAttributeConfigs TabView specific properties.

Parameters:
  `attr <Object>` Hash of initial attributes

#### removeTab

`removeTab ( item )`
Removes the specified Tab from the TabView.

Parameters:
  `item <YAHOO.widget.Tab>` The Tab instance to be removed.

Returns: ``
  void

#### selectTab

`void selectTab ( index )`
Makes the tab at the given index the active tab

Parameters:
  `index <Int>` The tab index to be made active

#### toString

`toString ( )`
Provides a readable name for the TabView instance.

Returns: ``
  String

#### Methods inherited from YAHOO.util.Element:

`_setHTMLAttrConfig, addClass, addListener, appendChild, appendTo, delegate, fireQueue, getElementsByClassName, getElementsByTagName, getStyle, hasChildNodes, hasClass, initAttributes, insertBefore, on, removeChild, removeClass, removeDelegate, removeListener, replaceChild, replaceClass, setStyle, subscribe`

#### Methods inherited from YAHOO.util.AttributeProvider:

`configureAttribute, fireBeforeChangeEvent, fireChangeEvent, get, getAttributeConfig, getAttributeKeys, refresh, register, resetAttributeConfig, resetValue, set, setAttributeConfig, setAttributes`

#### Methods inherited from YAHOO.util.EventProvider:

`createEvent, fireEvent, hasEvent, subscribe, unsubscribe, unsubscribeAll`

### Events

#### activeIndexChange

`activeIndexChange ( event )`
Fires when the value for the configuration attribute 'activeIndex' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### activeTabChange

`activeTabChange ( event )`
Fires when the value for the configuration attribute 'activeTab' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeActiveIndexChange

`beforeActiveIndexChange ( event )`
Fires before the value for the configuration attribute 'activeIndex' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeActiveTabChange

`beforeActiveTabChange ( event )`
Fires before the value for the configuration attribute 'activeTab' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeOrientationChange

`beforeOrientationChange ( event )`
Fires before the value for the configuration attribute 'orientation' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTabsChange

`beforeTabsChange ( event )`
Fires before the value for the configuration attribute 'tabs' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### orientationChange

`orientationChange ( event )`
Fires when the value for the configuration attribute 'orientation' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### tabsChange

`tabsChange ( event )`
Fires when the value for the configuration attribute 'tabs' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### Events inherited from YAHOO.util.Element:

`appendTo, available, beforeAppendTo, beforeElementChange, contentReady, elementChange,`

### Configuration Attributes

#### activeIndex `- Int`

The index of the tab currently active.

#### activeTab `- YAHOO.widget.Tab`

The tab currently active.

#### orientation `- String`

How the Tabs should be oriented relative to the TabView.
Default Value: "top"

#### tabs `- Array`

The Tabs belonging to the TabView instance.

#### Configuration attributes inherited from YAHOO.util.Element:

`element`

Copyright © 2010 Yahoo! Inc. All rights reserved.