import * as React from "react"; import { FormElementProps, FormElementRegistration } from "@vertigis/workflow"; /** * The generic type argument provided to `FormElementProps` controls the type * of `props.value` and `props.setValue(value)`. If your element doesn't need a * `value`, you can omit the type argument. * * You can also declare additional public properties of your element by adding * properties to this interface. The properties will be managed by the Workflow * runtime, and passed in as `props`. You can update the properties by using * `props.setProperty(key, value)`. */ interface FooProps extends FormElementProps {} /** * A Workflow element built using React. * @displayName * @description * @param props The props that will be provided by the Workflow runtime. */ function Foo(props: FooProps): React.ReactElement { const { setValue, value } = props; return ( setValue(event.currentTarget.value)} value={value} /> ); } const FooElementRegistration: FormElementRegistration = { component: Foo, getInitialProperties: () => ({ value: "Hello World" }), id: "Foo", }; export default FooElementRegistration;