Are there any JavaScript UI APIs / libraries to help you build native looking UI for elements created using JavaScript? For example, say I get a list of Contacts via JavaScript remoting. I want to render those in the equivalent of a VisualForce pageBlock, with a pageBlockSection that has a pageBlockTable so that everything looks native.

Yes, it's possible to just copy the markup from a VisualForce page and create the same structure of DOM elements and classes from JavaScript, but that is very prone to break as Salesforce changes its CSS between releases. Another issue is that interactive components such as a collapsible <apex:pageBlockSection> won't work.

Is there a good way to build native UI without VisualForce or some libraries that can help?

1 Answer 1


There is no official way to build native elements via Javascript at this point in time. Like you say, your only option is to re-create the markup by studying it, but you're 100% correct when you say it's prone to breaking.

Perhaps the best option for now would be to do a bit of a combination effort, perhaps have dummy DOM elements rendered by the VF which you then clone with Javascript? You'd still have issues with areas of the page that rely on Javascript though.

  • Thanks! It's a bummer they haven't made public APIs for this. I had the thought of injecting more data into dummy templates too so I think I'll go with that.
    – jon_wu
    Commented Mar 11, 2014 at 17:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .