# Yahoo! UI Library

### tabview 2.3.1

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

Show Private Show Protected

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

A representation of a Tab's label and content.

### Constructor

YAHOO.widget.Tab `( element , properties )`

Parameters:
  `element <HTMLElement | String>` (optional) The html element that represents the TabView. An element will be created if none provided.
  `properties <Object>` A key map of initial properties

### Properties

#### ACTIVE_CLASSNAME `- String`

The class name applied to active tabs.
Default Value: "selected"

#### dataConnection `- Object`

Provides a reference to the connection request object when data is loaded dynamically.

#### DISABLED_CLASSNAME `- String`

The class name applied to disabled tabs.
Default Value: "disabled"

#### LABEL_INNER_TAGNAME `- String`

The default tag name for a Tab's inner element.
Default Value: "em"

#### loadHandler `- object`

Object containing success and failure callbacks for loading data.

#### LOADING_CLASSNAME `- String`

The class name applied to dynamic tabs while loading.
Default Value: "disabled"

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

#### initAttributes

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

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

Returns: `void`

#### toString

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

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

#### activeChange

`activeChange ( )`
Fires after the active state is changed.

See: Element.addListener

Event fields:
`<String> type` activeChange
`<Boolean> prevValue` the previous value
`<Boolean> newValue` the updated value

Usage:
`var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('activeChange', handler);`

#### beforeActiveChange

`beforeActiveChange ( )`
Fires before the active state is changed.

See: Element.addListener

If handler returns false, the change will be cancelled, and the value will not be set.

Event fields:
`<String> type` beforeActiveChange
`<Boolean> prevValue` the current value
`<Boolean> newValue` the new value

Usage:
`var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('beforeActiveChange', handler);`

#### beforeContentChange

`beforeContentChange ( )`
Fires before the tab content is changed.

See: Element.addListener

If handler returns false, the change will be cancelled, and the value will not be set.

Event fields:
`<String> type` beforeContentChange
`<String> prevValue` the current value
`<String> newValue` the new value

Usage:
`var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('beforeContentChange', handler);`

#### beforeLabelChange

`beforeLabelChange ( )`
Fires before the tab label is changed.

See: Element.addListener

If handler returns false, the change will be cancelled, and the value will not be set.

Event fields:
`<String> type` beforeLabelChange
`<String> prevValue` the current value
`<String> newValue` the new value

Usage:
`var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('beforeLabelChange', handler);`

#### contentChange

`contentChange ( )`
Fires after the tab content is changed.

See: Element.addListener

Event fields:
`<String> type` contentChange
`<String> prevValue` the previous value
`<Boolean> newValue` the updated value

Usage:
`var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('contentChange', handler);`

#### labelChange

`labelChange ( )`
Fires after the tab label is changed.

See: Element.addListener

Event fields:
`<String> type` labelChange
`<String> prevValue` the previous value
`<String> newValue` the updated value

Usage:
`var handler = function(e) {var previous = e.prevValue};
myTabs.addListener('labelChange', handler);`

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

`available, contentReady,`

### Configuration Attributes

#### activationEvent `- String`

The event that triggers the tab's activation.

#### active `- Boolean`

Whether or not the tab is currently active. If a dataSrc is set for the tab, the content will be loaded from the given source.

#### cacheData `- Boolean`

Whether or not content should be reloaded for every view.
Default Value: false

#### content `- String`

The tab's content.

#### contentEl `- HTMLElement`

The HTMLElement that contains the tab's content.

#### contentVisible `- Boolean`

The Whether or not the tab's content is visible.
Default Value: false

#### dataLoaded `- Boolean`

Whether or not any data has been loaded from the server.

#### dataSrc `- String`

The tab's data source, used for loading content dynamically.

#### dataTimeout `- Number`

Number if milliseconds before aborting and calling failure handler.
Default Value: null

#### disabled `- Boolean`

Whether or not the tab is disabled.

#### href `- String`

The href of the tab's anchor element.
Default Value: '#'

#### label `- String`

The tab's label text (or innerHTML).

#### labelEl `- HTMLElement`

The element that contains the tab's label.

#### loadMethod `- String`

The method to use for the data request.
Default Value: "GET"

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

`element,`

Copyright © 2007 Yahoo! Inc. All rights reserved.