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

What's new in v7

This page lists the main features v7 adds for a v6 user, each with a link to its documentation. The breaking changes and the steps to upgrade are in the 7.x upgrade guide.

A different @rjsf/core​

@rjsf/core in v7 is very different from v6's.

  • It no longer renders Bootstrap 3 markup. @rjsf/bootstrap3 keeps that markup for apps that still style it; it is deprecated and will be removed in v8. See Supported themes and Bootstrap 3 markup moved from core to @rjsf/bootstrap3.
  • Its markup is plain and framework-neutral. Two optional stylesheets style it: rjsf.css lays the form out and rjsf-theme.css gives it a default look. The classMap prop sets or extends the class of each element core renders, so core's markup can be styled with Tailwind. See Customizing with other frameworks and classMap.
  • Form is a function component. As in v6, it takes its data as formData or as initialFormData, a seed it reads on mount and then keeps its own data from, and it now reads formData only when you pass a new value. See Form takes its data as initialFormData or formData.

Presentation for theme builders​

Before rendering a field, the form now computes its presentation plan: whether the FieldTemplate or the widget or field draws each of the label, description, help and errors, and which ids and ARIA attributes tie them to the control. A theme reads the plan instead of working out these parts itself. See Presentation.

  • A theme declares a ThemePresentation: which parts its fields and widgets draw themselves, how a label the template draws reaches the control (labelledBy), and the order its FieldTemplate draws the description and help in (fieldTemplateOrder), so a screen reader announces them in the order they appear. mergeThemePresentation() layers it over core's, and the Form's presentation prop over the theme's, so a custom widget or field can declare the parts it draws.
  • @rjsf/utils adds helpers that read the plan, among them resolveFieldPresentation(), widgetAriaProps(), getControlAttributes() and getGroupAttributes(), which give a control or a group of radios or checkboxes its aria-labelledby, aria-describedby and aria-invalid, and templateDrawsLabel(), templateLabelFor(), templateMarksRequired() and hasWidgetErrors(), which tell a template what to draw.
  • @rjsf/snapshot-tests adds contract tests a theme can run, such as presentationContractTests(), checkboxLabelTests(), controlNameTests() and requiredCueTests(), which check that each control is named and described once and each part is drawn exactly once.

Working with form data​

  • A form passed formData reads it only when you pass a value other than the one you passed before, so an unrelated prop change no longer replaces the edits you didn't store. A form passed initialFormData owns its data, as in v6. See formData and initialFormData.
  • A React Server Component, such as a Next.js App Router page, can import and render Form directly, without a 'use client' module of your own. See Server components.
  • A ref typed FormRef<T> reads the current value with getFormData(), so you no longer have to copy every onChange into state to know what the form holds. See The imperative handle.
  • getStatus() reports whether the data differs from its baseline, which fields the user touched and how many submits reached the form. You can warn before closing a page with unsaved edits or disable submit until something changed. See Read the form status and Unsaved changes.
  • onSubmit can return a promise. Until it settles, the form ignores another submit and marks its submit button pending, and it works with useActionState. See A pending submission.
  • The transformChange(next, previous) prop decides what each edit leaves the form with, so you can refuse or rewrite an edit in one place. See transformChange.

Validation and required fields​

  • liveErrors="field" shows a live-validated field's errors only once the user has changed it or left it, or after a submit, so editing one field no longer shows errors on fields the user hasn't reached yet. See liveErrors.
  • ui:required makes a field required from the uiSchema, and the form enforces it on submit and in live validation. ui:initialValue pre-fills a field without adding a default to the schema. See required and initialValue.

Schemas the form can now render​

  • A field whose type lists several types, such as ['string', 'number', 'null'], can show a selector of those types beside the field for the chosen one when useFallbackUiForUnsupportedType is on. See Multiple types.
  • When propertyNames lists the allowed key names, each additional property's key is a dropdown of the names still free. See Constraining key names with propertyNames.
  • additionalPropertiesWhenAbsent="allow" reads an object that names no additionalProperties as taking extra keys, as JSON Schema does, and gives it an add button. See Objects naming no additionalProperties.
  • ui:options.optgroups groups a select's options under headings, in @rjsf/core and every theme. See optgroups.

TypeScript​

  • StrictUiSchema is an opt-in UiSchema type that rejects a ui:widget, ui:field or ui:options value that doesn't fit the field's type. You can adopt it one form at a time. See Type-safe UiSchema.