---
schema_version: "1"
id: a09532bb6ed5b8ba2be6a4a6a3191256e50c429a564c7cbe39f49cff0d328757
title: Best Practices for <apex:panelbar>
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/best-practices/pages-compref-additional-panelbar.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-compref-additional-panelbar.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9179d15fac04e7192bb5ded1e8b5f01423e6601982ffc2993b4e59d04efc9d60
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Best Practices for \<apex:panelbar>

## Adding a Collection of Child `<apex:panelBarItem>` Components to an `<apex:panelBar>` Component

An `<apex:panelBar>` component can only have `<apex:panelBarItem>` child components. Sometimes, though, you want to add a collection of child components. For example, you may want to add an item for each contact associated with an account. You can do this by wrapping `<apex:panelBarItem>` in an `<apex:repeat>` component, as follows:

**note:** For this page to display account data, the ID of a valid account record must be specified as a query parameter in the URL for the page. For example: https://_MyDomain_login_URL_/apex/myPage?id=001D000000IRosz

<!-- otherprops: apex_page set_clipboard -->
```markupex1
<apex:page standardController="account">
  <apex:panelBar >
    <apex:repeat value="{!account.contacts}" var="c">
      <apex:panelBarItem label="{!c.firstname}">one</apex:panelBarItem>
    </apex:repeat>
  </apex:panelBar>
</apex:page>
```

