@letar/forms

Debug Values

Interactive JSON inspector for form state — see values update in real time

Overview

Form.DebugValues renders a live JSON tree of all form values. It auto-detects dark/light theme and is hidden in production by default.

<Form schema={Schema} initialValue={data} onSubmit={save}>
  <Form.Field.String name="title" />
  <Form.Field.Number name="price" />
  <Form.DebugValues />
  <Form.Button.Submit />
</Form>

Props

PropTypeDefaultDescription
titlestring"Form Values"Block heading
collapsednumber2JSON tree expansion depth
showInProductionbooleanfalseShow even in production builds

Theme Detection

The inspector automatically matches your app's color scheme by checking:

  1. dark class on <html> (next-themes)
  2. data-theme="dark" attribute
  3. style.colorScheme property

When to Use

  • During development — see exactly what values the form holds
  • Debugging validation — check what data reaches onSubmit
  • Complex forms — inspect nested groups and array values
  • Schema testing — verify .meta() and transforms work correctly

Production Override

For debugging in staging or production:

<Form.DebugValues showInProduction />

Without showInProduction, the component returns null in production builds — zero bundle impact.


Live Example

Try the interactive example on forms-example.letar.best.

On this page