An attribute tag is a definition of an attribute of a custom component and it 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. The below piece of code shows the syntax for including them:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<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"/>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<h1 style="border:{!borderColor}">
<apex:outputText value="{!myValue}"/>
</h1>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</apex:component>