Salesforce: Use Tab in Visualforce Page

Visualforce Page:

<apex:page doctype="html-5.0" standardcontroller="account" tabstyle="account">
    <apex:pageblock title="{!account.Name}">
        <apex:tabpanel id="tabpanel">
         
            <apex:tab label="Account Details" rerender="tabpanel" switchtype="ajax">
            <apex:detail relatedlist="false"></apex:detail>
            </apex:tab>
             
            <apex:tab label="Contacts" rerender="tabpanel" switchtype="ajax">
            <apex:relatedlist list="Contacts"></apex:relatedlist>
            </apex:tab>
             
            <apex:tab label="Opportunities" rerender="tabpanel" switchtype="ajax">
            <apex:relatedlist list="Opportunities"></apex:relatedlist>
            </apex:tab>
             
            <apex:tab label="Cases" rerender="tabpanel" switchtype="ajax">
             <apex:relatedlist list="Cases"></apex:relatedlist>
            </apex:tab>
             
        </apex:tabpanel>
    </apex:pageblock>
</apex:page>

Note: Please pass account id in url e.g.
https://salesforce.com/apex/TabInVisualForcePage?id=0019000001DEV5z

Output:

index

Leave a Reply