function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bhanu challengebhanu challenge 

can any of U plz define this..

what is attribute ?

what is  components ?
 in vf page...........
Best Answer chosen by bhanu challenge
Amit Chaudhary 8Amit Chaudhary 8
Pleasxe check below post for more information
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_html_features_pass_through_attributes.htm
2) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm
To add a pass-through attribute to, for example, an <apex:outputPanel> component, prefix the attribute with “html-” and set the attribute value as normal.
<apex:page showHeader="false" standardStylesheets="false" doctype="html-5.0">

    <apex:outputPanel layout="block" html-data-role="panel" html-data-id="menu">
        <apex:insert name="menu"/>    
    </apex:outputPanel>

    <apex:outputPanel layout="block" html-data-role="panel" html-data-id="main">
        <apex:insert name="main"/>    
    </apex:outputPanel>

</apex:page>
In above example below are component
<apex:page
<apex:outputPanel
<apex:insert

And below are attribute
showHeader
standardStylesheets
doctype

<apex:page showHeader="false" standardStylesheets="false" doctype="html-5.0">

Please check below post for all attribute list on page component

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm

You can also define your own componet and attribute like below
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_attribute.htm


apex:attribute
A definition of an attribute on a custom component. The attribute tag can only be a child of a component tag.
Note that you cannot define attributes with names like id or rendered. These attributes are automatically created for all custom component definitions.
<!-- 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>

Let us know if this will help you
 

All Answers

Amit VaidyaAmit Vaidya
Hi Bhanu,

Please consider this example:
 
<!-- 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>

So as per this example, 
1) <apex:page> using the component(i.e. myComponent). You can create myComponent under Setup->Build->Develop->Visualforce Components.
2) <apex:attribute> is same like variable which can be used for storing the value of mentioned data type. Like in above example, myvalue is an attribute of String type.
3) <apex:attribute> can be used only inside <apex:component></apex:component> tags.

Thanks,
Amit
Amit Chaudhary 8Amit Chaudhary 8
Pleasxe check below post for more information
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_html_features_pass_through_attributes.htm
2) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm
To add a pass-through attribute to, for example, an <apex:outputPanel> component, prefix the attribute with “html-” and set the attribute value as normal.
<apex:page showHeader="false" standardStylesheets="false" doctype="html-5.0">

    <apex:outputPanel layout="block" html-data-role="panel" html-data-id="menu">
        <apex:insert name="menu"/>    
    </apex:outputPanel>

    <apex:outputPanel layout="block" html-data-role="panel" html-data-id="main">
        <apex:insert name="main"/>    
    </apex:outputPanel>

</apex:page>
In above example below are component
<apex:page
<apex:outputPanel
<apex:insert

And below are attribute
showHeader
standardStylesheets
doctype

<apex:page showHeader="false" standardStylesheets="false" doctype="html-5.0">

Please check below post for all attribute list on page component

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm

You can also define your own componet and attribute like below
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_attribute.htm


apex:attribute
A definition of an attribute on a custom component. The attribute tag can only be a child of a component tag.
Note that you cannot define attributes with names like id or rendered. These attributes are automatically created for all custom component definitions.
<!-- 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>

Let us know if this will help you
 
This was selected as the best answer