templates

Often used in conjunction with the fields option, templates allows you to define a custom output for new or existing fields.

For total control in creating not only custom controls but also custom output see: Controls, Control Plugins and Layout

Usage

let fields = [{
  label: 'Star Rating',
  attrs: {
    type: 'starRating'
  },
  icon: '🌟'
}];
let templates = {
  starRating: function(fieldData) {
    return {
      field: '<span id="'+fieldData.name+'">',
      onRender: function() {
        $(document.getElementById(fieldData.name)).rateYo({rating: 3.6});
      }
    };
  }
};
$(container).formBuilder({templates});

See it in Action