# Yahoo! UI Library

### tabview 2.5.1

Yahoo! UI Library > tabview > YAHOO.widget.TabView

Show Private Show Protected

## 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

#### addTab

`void 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`
  void

#### contentTransition

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

Returns: `void`

#### DOMEventHandler

`void DOMEventHandler ( e )`
Routes childNode events.

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

Returns: `void`
  void

#### getTab

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

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

Returns: `void`
  YAHOO.widget.Tab

#### getTabIndex

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

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

Returns: `void`
  int

#### initAttributes

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

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

Returns: `void`

#### initTabs

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

Returns: `void`
  void

#### removeTab

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

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

Returns: `void`
  void

#### toString

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

Returns: `void`
  String

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

`_registerHTMLAttr, addClass, addListener, appendChild, appendTo, fireQueue, getElementsByClassName, getElementsByTagName, getStyle, hasChildNodes, hasClass, initAttributes, insertBefore, on, removeChild, removeClass, 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 ( eventInfo )`
Fires when the value for the configuration attribute 'activeIndex' changes.

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

#### activeTabChange

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

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

#### beforeActiveIndexChange

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

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

#### beforeActiveTabChange

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

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

#### beforeOrientationChange

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

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

#### beforeTabsChange

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

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

#### orientationChange

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

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

#### tabsChange

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

Parameters:
  `eventInfo <{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 © 2007 Yahoo! Inc. All rights reserved.