Skip to main content
Version: Current (v7.0.0-beta.3)

displayLabel, rawErrors, hideLabel and getDisplayLabel are deprecated for the field plan

Detect​

  • displayLabel, rawErrors or hideLabel read from the props of a custom FieldTemplate, field or widget in your code.
  • rawErrors read in a custom ArrayFieldTemplate or ObjectFieldTemplate in your code.
  • getDisplayLabel() or schemaUtils.getDisplayLabel() imported from @rjsf/utils or called in your code.
  • Your editor strikes these names through as @deprecated, or a no-deprecated lint rule reports them.

Change​

SchemaField now plans each field before rendering it (#5490). From the field and widget it renders, and the presentation the registry merges from @rjsf/core, the theme and the Form, it decides who draws the field's label, description, help and errors, under which ids, and the attributes its control carries. The plan reaches the FieldTemplate, the field and its widget as a presentation prop, described in resolveFieldPresentation(), and the props templates and widgets already read are now derived from it. A registry built by hand needs that merged presentation too; see A hand-built Registry needs presentation and classMap.

The deprecated names stay through v7 for a template or widget rendered without a plan, and the props are still handed over in full, for a component that renders the hidden errors its own way. Read the plan instead, or these helpers, which fall back to the old props only when there is no plan:

You readRead instead
displayLabel or getDisplayLabel() in a templatetemplateDrawsLabel()
hideLabel in a widget that draws its own labelwidgetDrawsLabel()
rawErrors for a widget's control error statehasWidgetErrors()
rawErrors for the label or description a widget draws for its fieldfieldShowsOwnErrors()
rawErrors for the error state in a FieldTemplate, ArrayFieldTemplate or ObjectFieldTemplatehasErrors
rawErrors for the error state in a fieldpresentation.errors.own
rawErrors for the messages a widget or container template drawsgetErrorsToDraw()
rawErrors for the messages a field draws itselfpresentation.errors.messages

The rawErrors a field, an ArrayFieldTemplate or an ObjectFieldTemplate is handed carry the errors whatever hideError says (#5325). The plan's presentation.errors.messages already has ui:hideError applied. A widget or container template draws those messages only where presentation.errors.by is 'self', since the template draws them under 'template', and getErrorsToDraw() gives it exactly those. A field reads presentation.errors.messages itself, because getErrorsToDraw() gives a field that draws its own errors none, so that a widget it spreads its plan into doesn't draw them again.

- const errors = hideError ? [] : (rawErrors ?? []);
+ const errors = getErrorsToDraw(props);

How a widget or template takes its error state from the plan is in A custom widget or theme takes its error state from hasWidgetErrors and Custom field, array and object templates take their error state from hasErrors. What a template, a widget and a custom field now draw is in A custom FieldTemplate, ObjectFieldTemplate or ArrayFieldTemplate draws what the plan hands it, A custom widget reads its label, description and required marker from the plan and A custom field draws its own label and description.

Verify​

  • Your editor shows no @deprecated strikethrough on those names.
  • Your templates and widgets draw the same label and errors as before, and an error hidden by ui:hideError stays hidden.

Also read: