+ Start a Discussion

Using Tabs inside repeat...

<apex:page Controller="testController">
<apex:tabPanel switchType="ajax" id="theTabPanel">
<apex:repeat value="{!stringList}" var="astring" id="theRepeat">
<apex:tab label="{!astring}">

public class testController {

String[] ss;
public String[] getStringList() {
return ss;

public testController() {
this.ss = new String[]{'a', 'b', 'c'};


I want to create a variable number of tabs with repeat statement. The code above doesn't work...Any work arounds anyone can think of?


If you know what tabs are possible in the list: you can create them all without a repeat loop and then set a "rendered" condition to see if that tab is to show on this page render.
Thanks. I am doing something similar - just listing all the tabs.  In my case, I need to render all of them, but the number of tabs is variable.

The problem is that most of the code is duplication across tabs - hassles in maintainence - in one case I have listed 15 tabs.

I was  hoping I could use a repeat statement to just use one tab tag and have the system duplicate it.

here is an idea for SFDC to support apex:tab inside of apex:repeat:


Please vote for the idea!