HooksuseFormHandlers

useFormHandlers

useFormHandlers is a generic form-state hook designed to compose with RapidKit form components.

What It Handles

  • field values
  • touched state
  • field errors
  • submit lifecycle
  • reset lifecycle
  • Zod-compatible schema validation through safeParse

Login Page Composition Example

The example below demonstrates composing useFormHandlers with RapidKit Input, Checkbox, Button, and Text components.

Authentication Draft

Welcome back

Sign in using RapidKit components and useFormHandlers.

Remember me

Draft Commit State Sync Example

This example shows using the same handlers in a detail editor where a local draft is validated and then committed to external source-of-truth state.

Source-of-Truth State

This panel represents external source-of-truth data.

Payments API - Platform Team

Critical service for card authorization.
Detail State Editor

Uses shared handlers; commits validated draft to source-of-truth on Apply.

Real-Time State Sync Example

This variant pushes changes to external source-of-truth state immediately on each edit (no Apply button).

Source-of-Truth State (Live)

Updates immediately on each change.

Identity Gateway - Security Team

Issues OIDC tokens and validates sessions.
Detail State Editor

Uses shared handlers only.

Validation Order

  1. schema errors are computed first.
  2. validate errors are merged next.
  3. validate errors override schema errors on the same field.