Custom Component Markup | Techila
single,single-post,postid-1300,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive

Custom Component Markup


Custom Component Markup

All markup for a custom component is defined within an <apex:component> tag. This tag must be the top-level tag in a custom component definition

For a more complex example, you could use a custom component to create a form that is used across multiple Visualforce pages. Create a new custom component named recordDisplay and copy the following code:


Notice that the markup can be a combination of Visualforce and HTML tags, just like other Visualforce pages.


<apex:component controller=”Account”>

    <apex:attribute name=”record” description=”The type of record we are viewing.”

                    type=”Object” required=”true”/>

    <apex:pageBlock title=”Viewing {!record}”>  

        <apex:detail />




Next, create a page called displayRecords and use the following code:


<apex:page StandardController=”Account”>

  <c:recordDisplay record=”Account” />



Output of the above code is as follows:



Author: techila

No Comments

Post A Comment