foundation-forms.rendererentry
Home > @genesislcap/foundation-forms > RendererEntry
RendererEntry type
Defines a renderer configuration in JSON forms. Allows to specify the renderer component, a tester function to determine renderer applicability, and a mapper function to connect JSON forms state to renderer's props.
Signature:
export type RendererEntry = {
renderer: ViewTemplate<DispatchRenderer, any>;
tester: RankedTester;
mapper: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfControl;
};
Remarks
If you are writing a React renderer, use createReactRenderer from @genesislcap/foundation-react-utils instead of constructing this type directly. It handles the FAST template boilerplate and shadow DOM event wiring for you.
Example
Here's a simple example (FAST/web-component renderer):
const stringEntry: RendererEntry = {
renderer: StringControlRendererTemplate,
tester: rankWith(2, isStringControl),
mapper: mapStateToControlProps,
};