Interface FormProps

The input structure for creating a new form, either by directly rendering it as component in Ink, or by invoking openForm(form) with it. You have to supply a form attribute to define the structure of the form. You should also supply a onSubmit attribute to receive the results when the user submits the form.

The form is uncontrolled by default, you can specify an initial value with initialValue. You can also switch to controlled mode by explicitly setting a value and reacting to onChange events.

interface FormProps {
    customManagers?: FormFieldManager<FormField>[];
    form: FormStructure;
    initialValue?: object;
    onChange?: ((value) => void);
    onSubmit?: ((value) => void);
    value?: object;
}

Properties

customManagers?: FormFieldManager<FormField>[]

You can use custom field implementations, by specifying their type attribute to a custom value and supplying a FormFieldManager here that can handle this type.

Structure of the form, i.e. which fields are contained in which sections.

initialValue?: object
onChange?: ((value) => void)

Type declaration

    • (value): void
    • Parameters

      • value: object

      Returns void

onSubmit?: ((value) => void)

Type declaration

    • (value): void
    • onSubmit is triggered when the user has completed all required fields and triggers the submit button at the end of the page.

      Parameters

      • value: object

        the final value of the form.

      Returns void

value?: object

Current value of the form. Omit to leave the component in uncontrolled mode.

Generated using TypeDoc