Rico Tabbed Panels #1

Valid HTML 4.01 Strict

Select which corners should be rounded on the tabs:

Rico Code

This example illustrates how to use the Rico.TabbedPanel behavior to transform a set of divs into a first class tabbed panel component.

The Rico.TabbedPanel is actually a very simple component built off of Rico behaviors and effects. It adds the necessary event handlers on the respective divs to handle the visual aspects of switching tabs.

The example HTML structure is an outer div that holds all of the panels. Then, each panel is just a couple of DIVs (one for the header and one for the content) wrapped in an outer DIV. You can actually use elements other than divs.
 <div id="tabContainer">
         <div id="panelHeaders">
           <div id="Header1">
         <div id="panelContents">
            <div id="Content1">
             ... content text ...

To attach the tabbed panel behavior to the tabbed panel container div, construct a Rico.TabbedPanel object and pass the panel titles and contents to it. With the Prototype Selector class it is very easy.
new Rico.TabbedPanel( $$('div.panelheader'), $$('div.panelContent') );


new Rico.TabbedPanel( $$('div.panelheader'), $$('div.panelContent'), 
                      {panelHeight  : 200, 
                       hoverClass   : 'mdHover',
                       selectedClass: 'mdSelected'} );
The second example specifies the height of the panels and the css classes that can be associated with the tabbed panel behaviors. There are many other configuration parameters that can be specified to modify various visual aspects of the tabbed panel. The panelHeight is the attribute that is most commonly overridden.