You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -700,6 +701,58 @@ The following props are passed to a custom field template component:
700
701
701
702
> Note: you can only define a single field template for a form. If you need many, it's probably time to look at [custom fields](#custom-field-components) instead.
702
703
704
+
### Array Field Template
705
+
706
+
Similarly to the `FieldTemplate` you can use an `ArrayFieldTemplate` to customize how your
707
+
arrays are rendered. This allows you to customize your array, and each element in the array.
Please see [customArray.js](https://github.com/mozilla-services/react-jsonschema-form/blob/master/playground/samples/customArray.js) for a better example.
726
+
727
+
The following props are passed to each `ArrayFieldTemplate`:
728
+
729
+
-`DescriptionField`: The generated `DescriptionField` (if you wanted to utilize it)
730
+
-`TitleField`: The generated `TitleField` (if you wanted to utilize it).
731
+
-`canAdd`: A boolean value stating whether new elements can be added to the array.
732
+
-`className`: The className string.
733
+
-`disabled`: A boolean value stating if the array is disabled.
734
+
-`idSchema`: Object
735
+
-`items`: An array of objects representing the items in the array. Each of the items represent a child with properties described below.
736
+
-`onAddClick: (event) => (event) => void`: Returns a function that adds a new item to the array.
737
+
-`readonly`: A boolean value stating if the array is readonly.
738
+
-`required`: A boolean value stating if the array is required.
739
+
-`schema`: The schema object for this array.
740
+
-`title`: A string value containing the title for the array.
741
+
742
+
The following props are part of each element in `items`:
743
+
744
+
-`children`: The html for the item's content.
745
+
-`className`: The className string.
746
+
-`disabled`: A boolean value stating if the array item is disabled.
747
+
-`hasMoveDown`: A boolean value stating whether the array item can be moved down.
748
+
-`hasMoveUp`: A boolean value stating whether the array item can be moved up.
749
+
-`hasRemove`: A boolean value stating whether the array item can be removed.
750
+
-`hasToolbar`: A boolean value stating whether the array item has a toolbar.
751
+
-`index`: A number stating the index the array item occurs in `items`.
752
+
-`onDropIndexClick: (index) => (event) => void`: Returns a function that removes the item at `index`.
753
+
-`onReorderClick: (index, newIndex) => (event) => void`: Returns a function that swaps the items at `index` with `newIndex`.
754
+
-`readonly`: A boolean value stating if the array item is readonly.
755
+
703
756
### Custom widgets and fields
704
757
705
758
The API allows to specify your own custom *widget* and *field* components:
0 commit comments