Yahoo! Developer Network Home - Help

YDN Site Search

# YUI Library Examples: TabView Control: Build from Markup

# TabView Control: Build from Markup

This demonstrates how to build a TabView from markup.

View example in new window.

Tab One Content

Tab Two Content

Tab Three Content

## TabView From Markup

One way you can build a YUI TabView widget is by including the required markup in your page. This is the most accessible way to provide tabbed content, because without script or styling, the tab links function as jump links to the associated content.

We will create a `<div>` called `demo` and include the TabView markup, which includes a list of navigational links that are anchored to a div in the `yui-content` container:

<div id="demo" class="yui-navset"> <ul class="yui-nav"> <li><a href="#tab1"><em>Tab One Label</em></a></li> <li class="selected"><a href="#tab2"><em>Tab Two Label</em></a></li> <li><a href="#tab3"><em>Tab Three Label</em></a></li> </ul> <div class="yui-content"> <div id="tab1"><p>Tab One Content</p></div> <div id="tab2"><p>Tab Two Content</p></div> <div id="tab3"><p>Tab Three Content</p></div> </div> </div>

All that is left is to create an instance of TabView from our `demo` element:

<script type="text/javascript"> var tabView = new YAHOO.widget.TabView('demo'); </script>

This is a basic example of how to build a TabView from markup.

### YUI Logger Output:

Note: Logging and debugging is currently turned off for this example.

Reload with logging
and debugging enabled.

### TabView Control Examples:

- Build from Markup
- Build from Script
- Adding Tabs
- Removing Tabs
- Getting Content from an External Source
- Skinning TabView
- Editor inside a Tabview Control (included with examples for Rich Text Editor (beta))
- ImageLoader with TabView (included with examples for ImageLoader Utility)
- Complex Application (included with examples for Layout Manager (beta))

### More TabView Control Resources:

- User's Guide (external)
- API Documentation
- Cheat Sheet PDF (external)

Copyright © 2008 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings