This is an example of the YUI AccordionView widget in action. This widget was created by Marco van Hylckama Vlieg. All code is licensed under the BSD license.
var menu6 = new YAHOO.widget.AccordionView('mymenu6', {collapsible: false, expandable: false, width: '300px', animate: true, animationSpeed: '0.2'});
var myPanels = [
{label: 'Dynamic item 1', content: '<p>Here is some content added dynamically.</p>'},
{label: 'Dynamic item 2', content: '<div class="padded"><ul><li>Lorem</li><li>Ipsum</li><li>Dolor</li></ul></div>'},
{label: 'Dynamic item 3', content: '<p><img src="http://farm3.static.flickr.com/2238/2293037745_c688d7a09c_m.jpg" alt="" class="block"></p>'},
{label: 'Dynamic item 4', content: '<p>Ok that\'s all folks!</p>'}
];
menu6.addPanels(myPanels);
menu6.appendTo('mycontainer');