A hand-built Registry needs presentation and classMap
Detect
- An object literal typed
Registry, or passed as aregistryprop, that your code or tests build by hand with nopresentationorclassMapkey. - Type checker:
Property 'presentation' is missing in type '{ fields: …; templates: …; widgets: …; … }' but required in type 'Registry<unknown, JSONSchema7, object>'.(TS2741), or the same forclassMap.
Change
The Registry type has two new required members:
presentationis theMergedThemePresentationthat declares which parts of a field each registered field and widget draws itself. It merges@rjsf/core's declarations, the theme's and theForm'spresentationprop.classMapis theMergedClassMapof class names for the elements@rjsf/corerenders, one key per element. It merges@rjsf/core's defaults, the theme'sclassMapand theForm'sclassMapprop. Core's components read their classes from it, beside therjsf-markers they always render.
Build the registry with buildRegistry() from @rjsf/core (see Form.getRegistry is now the buildRegistry export) or getTestRegistry() from @rjsf/core/testing (see getTestRegistry moved to @rjsf/core/testing), which fill both in. getTestRegistry() takes the presentation as a new last argument and an optional classMap after it.
Or add them yourself. For classMap, give every key of ClassMap, leaving a key without a class undefined rather than '', which renders an empty class attribute. Where nothing reads it, an empty object cast to MergedClassMap is enough:
-import type { Registry } from '@rjsf/utils';
+import { mergeThemePresentation } from '@rjsf/utils';
+import type { MergedClassMap, Registry } from '@rjsf/utils';
const registry: Registry = {
fields,
templates,
widgets,
+ presentation: mergeThemePresentation(),
+ classMap: {} as MergedClassMap,
// ...
};
Verify
The type checker accepts your registry literal. With every classMap key filled in, the rendered elements carry the classes you gave them and no empty class attribute.
Also read: