Skip to content

docs: Improve clarity and fix inconsistencies for UseFormProps between /ts/ and /api/useform/ pages #1178

@ryo-kozin

Description

@ryo-kozin

Overview

Currently, the documentation for useForm options (props) is fragmented and inconsistent across multiple pages. This creates significant confusion for developers, especially those trying to understand the correct TypeScript types and all available options.

Specific Problems

  1. Inconsistent Prop Lists Across Pages (The Core Issue)
    The biggest problem is that the "official" list of props for useForm is different depending on which page you are on.
  • On the /ts/ page:

Option | Description
-- | --
mode | Validation strategy before submitting behaviour.
reValidateMode | Validation strategy after submitting behaviour.
defaultValues | Default values for the form, this value will be cached.
values | Reactive values to update the form values.
errors | Server returns errors to update form. ⚠ Important: Keep the errors object reference-stable to avoid infinite re-renders.
resetOptions | Option to reset form state update while updating new form values.
criteriaMode | Display all validation errors or one at a time.
shouldFocusError | Enable or disable built-in focus management.
delayError | Delay error from appearing instantly.
shouldUseNativeValidation | Use browser built-in form constraint API.
shouldUnregister | Enable and disable input unregister after unmount.
disabled | Disable the entire form with all associated inputs.

  • On the /api/useform/ page: The "Generic props:" section lists all of the above, plus several props that are missing from the /ts/ type definition, such as:
    values, resetOptions, delayError, shouldUseNativeValidation.

export type UseFormProps<
  TFieldValues extends FieldValues = FieldValues,
  TContext extends object = object
> = Partial<{
  mode: Mode;
  reValidateMode: Mode;
  defaultValues: DeepPartial<TFieldValues>;
  resolver: Resolver<TFieldValues, TContext>;
  context: TContext;
  shouldFocusError: boolean;
  shouldUnregister: boolean;
  criteriaMode: 'firstError' | 'all';
}>;


  • On the /docs/useform/ page: This page presents a similar but again slightly different list and structure.

    This inconsistency forces developers to check all three pages to try and guess which one is the complete "Single Source of Truth" for all available options.

Suggested Improvements


I am happy to help create a Pull Request to address these documentation issues if the maintainers are open to it. Please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions