---
schema_version: "1"
id: c88831a1e3e4cddd87ff509a7b3d937497777b59b4bc4612884757120b974e14
title: apex:dynamicComponent
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-dynamiccomponent.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-compref-dynamiccomponent.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 76a9f085d3ae4b602bc0e0228c1a20dabe35b2cef974205eab26cc307e61ac65
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# apex:dynamicComponent

This tag acts as a placeholder for your dynamic Apex components. It has one required parameter—`componentValue`—which accepts the name of an Apex method that returns a dynamic component.

The following Visualforce components do not have dynamic Apex representations:

-   `<apex:attribute>`
-   `<apex:component>`
-   `<apex:componentBody>`
-   `<apex:composition>`
-   `<apex:define>`
-   `<apex:dynamicComponent>`
-   `<apex:include>`
-   `<apex:insert>`
-   `<apex:param>`
-   `<apex:variable>`

## Example

```apex
<apex:page controller="SimpleDynamicController">
    <apex:dynamicComponent componentValue="{!dynamicDetail}" />
</apex:page>

/* Controller */
public class SimpleDynamicController {

    public Component.Apex.Detail getDynamicDetail() {
        Component.Apex.Detail detail = new Component.Apex.Detail();
        detail.expressions.subject = '{!acct.OwnerId}';
        detail.relatedList = false;
        detail.title = false;
        return detail;
    }

    // Just return the first Account, for example purposes only
    public Account acct {
        get { return [SELECT Id, Name, OwnerId FROM Account LIMIT 1]; }
    }
}
```

## Attributes

|Attribute Name|Attribute Type|Description|Required?|API Version|Access|
|--------------|--------------|-----------|---------|-----------|------|
|`componentValue`|UIComponent|Accepts the name of an Apex method that returns a dynamic Visualforce component.|Yes|22.0||
|`id`|String|An identifier that allows the attribute to be referenced by other tags in the custom component definition.| |22.0|global|
|`invokeAfterAction`|Boolean|A Boolean value that, when true, specifies that componentValue's Apex method is called after the page's or submit's action method is invoked.| |31.0||
|`rendered`|Boolean|A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.| |22.0||

**See Also**  


-   [Creating and Displaying Dynamic Components](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/dynamic-vf/pages-dynamic-vf-components-implementation.md)

