@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
26 lines (25 loc) • 1.09 kB
TypeScript
import React from 'react';
import { AnyComponentSchema } from '../types';
export interface ComponentPreviewWrapperProps {
component: AnyComponentSchema;
/** Initial values for the preview component, e.g. `{"componentKey": "some_value"}` */
initialValues: Record<string, unknown>;
/** Handler to be called when the component JSON definition changes */
onComponentChange: (value: AnyComponentSchema) => void;
children: React.ReactNode;
}
export interface GenericComponentPreviewProps {
component: AnyComponentSchema;
onComponentChange: (value: AnyComponentSchema) => void;
}
/**
* Generic preview
*
* The preview component looks at the component.type and looks up the type-specific preview
* component to render it, all while wrapping it in some builder-specific markup. It also
* exposes controls to toggle between "WYSWIWYG" and JSON mode.
*
* It is also responsible for handling the `multiple: true` variants in a generic way.
*/
declare const GenericComponentPreview: React.FC<GenericComponentPreviewProps>;
export default GenericComponentPreview;