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
@@ -592,6 +593,7 @@ The following props are passed to a custom field template component:
592
593
-`required`: A boolean value stating if the field is required;
593
594
-`readonly`: A boolean value stating if the field is read-only;
594
595
-`displayLabel`: A boolean value stating if the label should be rendered or not. This is useful for nested fields in arrays where you don't want to clutter the UI.
596
+
-`formContext`: The `formContext` object that you passed to Form.
595
597
596
598
> Note: you can only define a single field template for a form. If you need many, it's probably time to look for [custom fields](#custom-field-components) instead.
597
599
@@ -643,6 +645,7 @@ The following props are passed to custom widget components:
643
645
-`readonly`: `true` if the widget is read-only;
644
646
-`onChange`: The value change event handler; call it with the new value everytime it changes;
645
647
-`options`: A map of options passed as a prop to the component (see [Custom widget options](#custom-widget-options)).
648
+
-`formContext`: The `formContext` object that you passed to Form.
646
649
647
650
> Note: Prior to v0.35.0, the `options` prop contained the list of options (`label` and `value`) for `enum` fields. Since v0.35.0, it now exposes this list as the `enumOptions` property within the `options` object.
648
651
@@ -769,7 +772,7 @@ render((
769
772
), document.getElementById("app"));
770
773
```
771
774
772
-
> Note: Registered fields can be reused accross the entire schema.
775
+
> Note: Registered fields can be reused across the entire schema.
773
776
774
777
#### Field props
775
778
@@ -781,6 +784,7 @@ A field component will always be passed the following props:
781
784
-`formData`: The data for this field;
782
785
-`errorSchema`: The tree of errors for this field and its children;
783
786
-`registry`: A [registry](#the-registry-object) object (read next).
787
+
-`formContext`: A [formContext](#the-formcontext-object) object (read next next).
784
788
785
789
#### The `registry` object
786
790
@@ -789,9 +793,14 @@ The `registry` is an object containing the registered custom fields and widgets
789
793
-`fields`: The [custom registered fields](#custom-field-components). By default this object contains the standard `SchemaField`, `TitleField` and `DescriptionField` components;
790
794
-`widgets`: The [custom registered widgets](#custom-widget-components), if any;
791
795
-`definitions`: The root schema [definitions](#schema-definitions-and-references), if any.
796
+
-`formContext`: The [formContext](#the-formcontext-object) object.
792
797
793
798
The registry is passed down the component tree, so you can access it from your custom field and `SchemaField` components.
794
799
800
+
#### The `formContext` object
801
+
802
+
You can provide a `formContext` object to the Form, which is passed down to all fields and widgets (including [TitleField](#custom-titles) and [DescriptionField](#custom-descriptions)). Useful for implementing context aware fields and widgets.
803
+
795
804
### Custom SchemaField
796
805
797
806
**Warning:** This is a powerful feature as you can override the whole form behavior and easily mess it up. Handle with care.
0 commit comments