---
schema_version: "1"
id: a06bd9b690329ea278ad1fc3992b84689e04f082b7f4a8215302e8209f30fb3a
title: Using Custom Components in a Visualforce Page
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/comp-cust/pages-comp-cust-using.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-comp-cust-using.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3ef1115277c741bc013a9be5d342da034356deed024c48ea5c383e14fedd2f1e
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Using Custom Components in a Visualforce Page

The body of an `<apex:component>` tag is the markup that is added to a standard Visualforce page whenever the component is included. For example, the following Visualforce page uses the component defined in [Custom Component Markup](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-comp-cust-elements-markup.md) (in this example, the component was saved with the name `myComponent`):

<!-- otherprops: apex_page -->

```markup
<apex:page standardController="Account">
   This is my <i>page</i>. <br/>
   <c:myComponent/>
</apex:page>
```

It results in the following output:

```nolang
This is my page.
This is my custom component.
```

To use a custom component in a Visualforce page you must prefix the component's name with the namespace in which the component was defined. For example, if a component named `myComponent` is defined in a namespace called `myNS`, the component can be referenced in a Visualforce page as `<myNS:myComponent>`.

For ease of use, a component that is defined in the same namespace as an associated page can also use the `c` namespace prefix. Consequently, if the page and component from the sample above are defined in the same namespace, you can reference the component as `<c:myComponent>`.

If you want to insert content into a custom component, use the [`<apex:componentBody>`](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/components/pages-compref-componentbody.md) tag.

Similar to standard components, when a custom component is updated or edited, the Visualforce page that references it is also updated.

**See Also**

- [What are Custom Components?](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-comp-cust-def.md)
- [Defining Custom Components](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-comp-cust-creating.md)
