Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Conform · Type Alias

DefaultValue

DefaultValue is the type used for initial Conform form data. It accepts a partial object matching the form shape or a URLSearchParams object.

How it works

DefaultValue describes the initial values accepted by Conform's form APIs. It can represent a partial object matching the form structure, allowing only some fields to be initialized, and it is also used alongside URLSearchParams for form initialization.

Syntax

defaultValue?: DefaultValue<FormShape> | URLSearchParams

Parameters

NameTypeDescription
defaultValueDefaultValue<FormShape> | URLSearchParamsOptional initial data for the form, represented by a partial object matching the form structure or URLSearchParams.

Key points

  • DefaultValue supplies the values used when the form is first initialized.
  • An object does not have to contain every field; its structure should correspond to the form.
  • URLSearchParams is the alternative representation documented for initial form data.
  • In useForm options, the generic is tied to FormShape and the property is optional.

Common mistakes

  • The value may be a partial form-shaped object or a URLSearchParams instance; it is not limited to a complete object.

Example: Using a form default value

const defaultValue: DefaultValue<{ email: string }> = {
  email: 'user@example.com',
};

const [form] = useForm({ defaultValue });

Pass a partial form-shaped object as the initial value when creating a form.

When to use it

Prepopulate fields from stored data

Editing an existing record

Initialize from URL-encoded values

Progressive form initialization

Set only the fields currently available

Partial drafts

Interview questions

QWhat does DefaultValue represent?

DefaultValue represents initial form data supplied to Conform. For useForm, the documented input can be a partial object matching the form structure or a URLSearchParams object.

Follow-up: Why might a partial object be useful? It lets callers initialize only the fields for which values are available, leaving other fields uninitialized.

QHow is DefaultValue supplied to a form?

It is passed through the form setup option named defaultValue. The value establishes the form's initial state rather than describing the current live state after editing.

Follow-up: Where can the current form state be read? Use the form metadata returned by Conform, which distinguishes initial values from the current value.

QWhat two input forms does the documentation specify?

A default can be provided as URLSearchParams when initialization data already uses URL-encoded form semantics. Otherwise, use an object whose shape corresponds to the form.

Follow-up: What should be checked when choosing the object form? Ensure its keys and nested structure correspond to the form schema expected by Conform.

  • useForm
  • FormShape
  • URLSearchParams
  • initialValue
  • value

Source: useForm. Checked 2026-10-15.