In our projects, many times we develop codes which are required again and again. So instead of repeating same code again and again, we can create visualforce component. In other words, visualforce component allows us to create reusable component.
To Create VF Components, Go to Setup -> Develop -> Visualforce Components and Create
A custom Visualforce component. All custom component definitions must be wrapped inside a single <apex:component> tag.
This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated container tag, <div> or <span>, depending on the layout attribute.
<!-- Page: -->
<apex:page>
<c:myComponent myValue="My component's value" borderColor="red" />
</apex:page>
<!-- Component:myComponent -->
<apex:component>
<apex:attribute name="myValue" description="This is the value for the component."
type="String" required="true"/>
<apex:attribute name="borderColor" description="This is color for the border."
type="String" required="true"/>
<h1 style="border:{!borderColor}">
<apex:outputText value="{!myValue}"/>
</h1>
</apex:component>
In our projects, many times we develop codes which are required again and again. So instead of repeating same code again and again, we can create visualforce component. In other words, visualforce component allows us to create reusable component.
To Create VF Components,
Go to Setup -> Develop -> Visualforce Components and Create
Warm Regards,
Sourav
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_comp_cust_using.htm
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_comp_cust_elements_attributes.htm
A custom Visualforce component. All custom component definitions must be wrapped inside a single <apex:component> tag.
This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated container tag, <div> or <span>, depending on the layout attribute.
Please let us know if this will help you
Thanks
Amit Chaudhary