You are here:
Defining Visualforce Custom Components
Visualforce components are small, reusable pieces of functionality—think widgets, panels, user interface elements, that kind of thing—that you use in Visualforce page markup. You can use standard Visualforce components, and create your own custom components.
Required Editions
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To create custom components: | Customize Application |
- In Salesforce from Setup, enter Components in the Quick Find box, then select Visualforce Components.
- Click New.
- In the Label text box, enter the text that should be used to identify the custom component in Setup tools.
- In the Name text box, enter the text that should identify this custom component in Visualforce markup. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
- In the Description text box, enter a text description of the custom component. This description appears in the component reference with other standard component descriptions as soon as you click Save.
- In the Body text box, enter Visualforce markup for the custom component definition. A single component can hold up to 1 MB of text, or approximately 1,000,000 characters.
- Click Version Settings to specify the version of Visualforce and the API used with this component. You can also specify versions for any managed packages installed in your organization.
- Click Save to save your changes and view the custom component’s detail screen, or click Quick Save to save your changes and continue editing your component. Your Visualforce markup must be valid before you can save your component.
For example, if you haven’t yet defined a
custom component named myNewComponent and insert
<c:myNewComponent myNewAttribute="foo"/>
into existing page markup, after clicking Save a quick fix allows
you to define a new custom component named myNewComponent with the following default
definition:
<apex:component>
<apex:attribute name="myattribute" type="String" description="TODO: Describe me"/>
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Component: mynewcomponent
<!-- End Default Content REMOVE THIS -->
</apex:component>You can modify this definition from Setup by entering Components in the Quick Find box, then selecting Visualforce Components, and then clicking Edit next to the myNewComponent custom component.

