@@ -332,6 +332,18 @@ of the titleMap can be HTML.
332332}
333333```
334334
335+ The submit button has btn-primary as default. The button has btn-default as default.
336+ We can change this with ``` style ``` attribute:
337+ ``` javascript
338+ {
339+ type: " actions" ,
340+ items: [
341+ { type: ' submit' , style: ' btn-success' , title: ' Ok' }
342+ { type: ' button' , style: ' btn-info' , title: ' Cancel' , onClick: " cancel()" }
343+ ]
344+ }
345+ ```
346+
335347### button
336348
337349* button* can have a ``` onClick ``` attribute that either, as in JSON Form, is a function * or* a
@@ -345,6 +357,15 @@ the ```sf-schema``` directive.
345357[
346358```
347359
360+ The submit button has btn-primary as default. The button has btn-default as default.
361+ We can change this with ``` style ``` attribute:
362+ ``` javascript
363+ [
364+ { type: ' button' , style: ' btn-warning' , title: ' Ok' , onClick : function (){ ... } }
365+ { type: ' button' , style: ' btn-danger' , title: ' Cancel' , onClick: " cancel()" }
366+ [
367+ ```
368+
348369### radios and radiobuttons
349370Both type * radios* and * radiobuttons* work the same way, they take a titleMap
350371and renders ordinary radio buttons or bootstrap 3 buttons inline. It's a
@@ -376,6 +397,37 @@ function FormCtrl($scope) {
376397}
377398```
378399
400+ With * radiobuttons* , both selected and unselected buttons have btn-primary as default.
401+ We can change this with ``` style ``` attribute:
402+ ``` javascript
403+ function FormCtrl ($scope ) {
404+ $scope .schema = {
405+ type: " object" ,
406+ properties: {
407+ choice: {
408+ type: " string" ,
409+ enum: [" one" ," two" ]
410+ }
411+ }
412+ };
413+
414+ $scope .form = [
415+ {
416+ key: " choice" ,
417+ type: " radiobuttons" ,
418+ style: {
419+ selected: " btn-success" ,
420+ unselected: " btn-default"
421+ },
422+ titleMap: {
423+ one: " One" ,
424+ two: " More..."
425+ }
426+ }
427+ ];
428+ }
429+ ```
430+
379431### help
380432Help fields is not really a field, but instead let's you insert arbitrary HTML
381433into a form, suitable for help texts with links etc.
@@ -470,9 +522,9 @@ schemas. Only a schema is supported by Schema Form, and not the list of schemas.
470522The * form* definition has the option ``` ìtems ``` that should be a list
471523of form objects.
472524
473- The rendered list of subforms each have a remove button and at the bottom there
474- is an add button. The text of the add button can be changed by the option
475- ``` add ``` , see example below.
525+ The rendered list of subforms each have a * "Remove" * button and at the bottom there
526+ is an * "Add" * button. The default * "Add" * button has class btn-default and text Add. Both
527+ could be changed using attribute ``` add ``` , see example below.
476528
477529If you like to have drag and drop reordering of arrays you also need
478530[ ui-sortable] ( https://github.com/angular-ui/ui-sortable ) and its dependencies
@@ -566,6 +618,9 @@ function FormCtrl($scope) {
566618 {
567619 key: " subforms" ,
568620 add: " Add person" ,
621+ style: {
622+ add: " btn-success"
623+ },
569624 items: [
570625 " subforms[].nick" ,
571626 " subforms[].name" ,
@@ -585,8 +640,11 @@ By default the tabs are on the left side (follows the default in JSON Form),
585640but with the option ``` tabType ``` you can change that to eiter * "top"* or * "right"*
586641as well.
587642
588- Every tab page has a * "Remove"* button, you can change the text on that with
589- the ``` remove ``` option.
643+ Every tab page has a * "Remove"* button. The default * "Remove"* button has class btn-default
644+ and text Remove. Both could be changed using attribute ``` remove ``` , see example below.
645+
646+ In this case we have an * "Add"* link, not an * "Add"* button. Therefore, the attribute ``` add ```
647+ only changes the text of the link. See example below.
590648
591649Bootstrap 3 doesn't have side tabs so to get proper styling you need to add the
592650dependency [ bootstrap-vertical-tabs] ( https://github.com/dbtek/bootstrap-vertical-tabs ) .
@@ -630,7 +688,11 @@ function FormCtrl($scope) {
630688 tabType: " top" ,
631689 title: " value.nick || ('Tab '+$index)"
632690 key: " subforms" ,
633- add: " Add person" ,
691+ remove: " Delete" ,
692+ style: {
693+ remove: " btn-danger"
694+ },
695+ add: " Add person" ,
634696 items: [
635697 " subforms[].nick" ,
636698 " subforms[].name" ,
0 commit comments