forms-js / discussions

6 stars 0 forks source link

Template fragment syntax #6

Open mohsen1 opened 9 years ago

mohsen1 commented 9 years ago

Each piece of the form should be made of a template fragment. A template fragment is a Handlebars HTML file that has fields related to that fragment.

For example, for boolean type we will have a checkbox. This is the proposal for the template fragment for boolean type:

<!---
  Boolean type
  ==========

  Fileds:
  name (string) - the name of the property: 
  title (string) - The title property

  Example Schema:
  {
    "type": "boolean",
    "title": "In the U.S."
  }
-->
<label>
   {{name}}
   <input type="checkbox" title="{{title}}>
</label>

Fragments should be well documented. Maybe we can fix the format of documentations and make a tool for validating fragments. Documentations makes it very easy to customize.

Question:

Should we put each fragments style in a inline <style> tag inside the html?

bvaughn commented 9 years ago

I like this template format.

However, inline styles would prevent users from using our pre-built template but with external stylesheet overrides. (I think this is likely to be a common use-case.)