<apex: facet> Component in Visualforce Page

The <apex: facet> is another important VF page component that acts as a placeholder for the content rendered in a specific part of the parent component. The header and footer of the <apex: dataTable> component are examples for which we can use the <apex: facet> component.

We use the <apex: facet> component for getting the user input for a controller property or method that doesn't correspond to a field on a Salesforce object.

  1. The existence of the <apex: facet> component in the body of the parent component is possible only when the parent supports facets.
  2. The facet component's name should match one of the pre-defined facet names on the parent component.
  3. The name determines the place where the content of the facet component is rendered.
  4. The appearance of the parent component doesn't depend on the order of the facet within the parent component body.

The <apex: facet> component has only one attribute, which is given below:

1. name

The name is a string-type attribute that specifies the facet's name to be rendered.

Syntax:

Let's take an example to understand how we can use the <apex: facet> component on the VF page:

ApexFacetExample.vfp

Output

apex: facet in Visualforce Page