---
schema_version: "1"
id: b781983f62c0d7bbc00753a7c0dea895658584cf78a0b3bf8109aeeba0248838
title: apex:facet
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/components/pages-compref-facet.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-compref-facet.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8e0b778ef7e089783081ade56dfb47754c9bf63c3aa3314ab9a788e06b0cac81
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# apex:facet

A placeholder for content that's rendered in a specific part of the parent component, such as the header or footer of an `<apex:dataTable>`.

Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only `<apex:inputField>` and `<apex:outputField>` can be used with sObject fields.

An `<apex:facet>` component can only exist in the body of a parent component if the parent supports facets. The name of the facet component must match one of the pre-defined facet names on the parent component. This name determines where the content of the facet component is rendered. The order in which a facet component is defined within the body of a parent component doesn't affect the appearance of the parent component.

See `<apex:dataTable>` for an example of facets.

**Note:** Although you can't represent an `<apex:facet>` directly in Apex, you can specify it on a dynamic component that has the facet. For example:

`Component.apex.dataTable dt = new Component.apex.dataTable(); dt.facets.header = 'Header Facet';`

## Example

```apex
<!-- For this example to render properly, you must associate the Visualforce page
with a valid account record in the URL.
For example, if 001D000000IRt53 is the account ID, the resulting URL should be:
https://MyDomain_login_URL/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->

<!-- Shows a two column table of contacts associated with the account.
The account column headers are controlled by the facets.-->

<apex:page standardController="Account">
    <apex:pageBlock title="Contacts">
        <apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
            <apex:column >
                <apex:facet name="header">Name</apex:facet>
                        {!contact.Name}
            </apex:column>
            <apex:column >
                <apex:facet name="header">Phone</apex:facet>
                        {!contact.Phone}
            </apex:column>
        </apex:dataTable>
    </apex:pageBlock>
</apex:page>
```

## Attributes

|Attribute Name|Attribute Type|Description|Required?|API Version|Access|
|--------------|--------------|-----------|---------|-----------|------|
|`name`|String|The name of the facet to be rendered. This name must match one of the pre-defined facet names on the parent component and determines where the content of the facet component is rendered. For example, the dataTable component includes facets named "header", "footer", and "caption".|Yes|10.0|global|

**See Also**  


-   [apex:dataTable](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-compref-datatable.md)
-   [Best Practices for Using Component Facets](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/best-practices/pages-compref-additional-facet.md)

