Default Values

Start of documentation content

Default form values can be provided to Formally through the defaultValues prop.

Intro

Pass in an object for the default values in your form. E.g. defaultValues={ { fieldId1: "my value" } }. In this example the "fieldId1" must correspond to a form field with that same id.

This is an SDK feature and it requires a licence. Please contact support for a licence.

Use of the defaultValues prop

import { Formally, Root, Page, Text, ControlsProps } from 'formally';

export const MyForm = () => (
  <Formally
    licence="your-licence-key"
    defaultValues={{
      myFieldId: 'my value',
    }}
  >
    <Root>
      <Page>
        <Text id="myFieldId" />
      </Page>
    </Root>
  </Formally>
);