### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev
- Next

### 6.10.14. <rich:tab> available since 3.0.0

expand all

#### 6.10.14.1. Description

The component defines a tab section within a tab panel.

Figure 6.104. <rich:tab> component

#### 6.10.14.2. Key Features

- Fully skinnable tabs content

- Disabled/enabled tab options

- Groups any content inside a tab

- Each tab has a unique name for a direct access (e.g. for switching between tabs)

- Switch methods can be easily customized for every tab separately with attribute to:

  - `Server`

  - `Client`

  - `AJAX`

#### 6.10.14.3. Details of Usage

The main component function is to define a content group that is rendered and processed when the tab is active, i.e. click on a tab causes switching onto a tab containing content corresponded to this tab.

The "label" attribute defines text to be represented. If you can use the "label" facet, you can even not use the "label" attribute.

    <rich:tab>

          <f:facet name="label">

                <h:graphicImage value="/images/img1.png"/>

          </f:facet>

           <!--Any Content inside-->

    </rich:tab>

A marker on a tab header defined with the "label" attribute. Moreover, each tab could be disabled (switching on this tab is impossible) with the "disable" attribute.

    <rich:tabPanel width="20%">

          <tabs:tab  label="Canon">

                <h:outputText value="Canon EOS Digital Rebel XT" />

                 ...

          </tabs:tab>

          <tabs:tab  label="Nikon">

                <h:outputText value="Nikon D70s" />

                 ...

          </tabs:tab>

          <tabs:tab label="Olympus">

                <h:outputText value="Olympus EVOLT E-500" />

                 ...

          </tabs:tab>

          <tabs:tab disabled="true" name="disabled" label="Disabled"/>

    </rich:tabPanel>

With this example it's possible to generate the tab panel with the last disabled and three active tabs (see the picture).

Figure 6.105. <rich:tabPanel> with disabled <rich:tab>

Switching mode could be defined not only for the whole panel tab, but also for each particular tab, i.e. switching onto one tab could be performed right on the client with the corresponding JavaScript and onto another tab with an Ajax request on the server. Tab switching modes are the same as tabPanel ones.

Each tab also has an attribute name (alias for "id" attribute). Using this attribute value it's possible e.g. to set an active tab on a model level specifying this name in the corresponding attribute of the whole tab.

Except the specific component attributes it has all necessary attributes for JavaScript event definition.

- `onmouseover`

- `onmouseout`

- etc.

Some event could be performed on the tab which has been entered/left using ""ontabenter"" and "ontableave" attributes. See the example below:

    <rich:tabPanel>

          <rich:tab label="Tab1" ontabenter="alert()">

           ...

          </rich:tab>

          ...

    </rich:tabPanel>

The following example shows how on the client side to get the names of `entered`/`left` tabs.

    ontabenter="alert(leftTabName)"

Information about the "process" attribute usage you can find in the "Decide what to process" guide section.

#### 6.10.14.4. Reference Data

Table of <rich:tab> attributes.

Table 6.146. Component Identification Parameters

Name | Value
--- | ---
component-type | org.richfaces.Tab
component-class | org.richfaces.component.html.HtmlTab
component-family | org.richfaces.Tab
renderer-type | org.richfaces.TabRenderer
tag-class | org.richfaces.taglib.TabTag

Table 6.147. Facet

Facet name | Description
--- | ---
label | Defines the text for the actual "tab" in a tab section

Table 6.148. Style classes (selectors) and mapped skin parameters

Class name | Description | Skin parameter | CSS property
--- | --- | --- | ---
.rich-tab-active | Defines styles for an active tab | generalTextColor | color
generalBackgroundColor | background-color
subBorderColor | border-color
.rich-tab-bottom-line | Defines styles for a tab bottom line | panelBorderColor | border-bottom-color
.rich-tab-disabled | Defines styles for a disabled tab | subBorderColor | border-color
tabBackgroundColor | background-color
tabDisabledTextColor | color
.rich-tab-header | Defines styles for a tab header | generalFamilyFont | font-family
generalSizeFont | font-size
generalTextColor | color
.rich-tab-inactive | Defines styles for an inactive tab | subBorderColor | border-color
tabBackgroundColor | background-color

Table 6.149. Internal style classes (selectors)

Class name (selector) | Description
--- | ---
.rich-tab-active | Defines styles for an active tab
.rich-tab-disabled | Defines styles for a disabled tab
.rich-tab-header | Defines styles for a tab header

You can find all necessary information about style classes redefinition in Definition of Custom Style Classes section.

#### 6.10.14.5. Relevant Resources Links

Visit TabPanel page at RichFaces LiveDemo for examples of component usage and their sources.

If you have any questions or ideas regarding the <rich:tab> tell about them at the RichFaces Users Forum.

- Prev6.10.13. <rich:tabPanel> available since 3.0.0
- Top of page
- Front page
- Next6.10.15. < rich:togglePanel > ...