Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Clarify registry object structure and that it's passed down to custom widgets #2886

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/advanced-customization/custom-widgets-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ The following props are passed to custom widget components:
- `options.enumOptions`: For enum fields, this property contains the list of options for the enum as an array of { label, value } objects. If the enum is defined using the oneOf/anyOf syntax, the entire schema object for each option is appended onto the { schema, label, value } object.
- `formContext`: The `formContext` object that you passed to Form.
- `rawErrors`: An array of strings listing all generated error messages from encountered errors for this widget.
- `registry`: A [registry](#the-registry-object) object (read next).

### Custom component registration

Expand Down Expand Up @@ -296,13 +297,13 @@ A field component will always be passed the following props:

The `registry` is an object containing the registered custom fields and widgets as well as the root schema definitions.

- `fields`: The [custom registered fields](#custom-field-components). By default this object contains the standard `SchemaField`, `TitleField` and `DescriptionField` components;
- `widgets`: The [custom registered widgets](#custom-widget-components), if any;
- `fields`: All fields, including [custom registered fields](#custom-field-components), if any;
- `widgets`: All widgets, including, [custom registered widgets](#custom-widget-components), if any;
- `rootSchema`: The root schema, which can contain referenced [definitions](#schema-definitions-and-references);
- `formContext`: The [formContext](#the-formcontext-object) object;
- `definitions` (deprecated since v2): Equal to `rootSchema.definitions`.

The registry is passed down the component tree, so you can access it from your custom field and `SchemaField` components.
The registry is passed down the component tree, so you can access it from your custom field, custom widget, and `SchemaField` components.

### Custom SchemaField

Expand Down